Take heed, regard not iniquity: for this hast thou chosen rather than affliction. - KJV
Satan was not done with Job after 2:10. The three "friends" came and through pitiless discourse brought out of Job a spirit of self-justification and of ascribing inequity to God's purposes. By continually accusing Job of bringing this upon himself through sinful acts Job is tricked into the position of defending his righteousness. This is the iniquity that Job has chosen rather than affliction. Chapter 31 is Job's final discourse and it is full of self-righteousness and accusation towards God.
Oh that one would hear me! behold, my desire is, that the Almighty would answer me, and that mine adversary had written a book. - v. 35
Elihu, then, is sent by God to call attention to Satan's trap and to rescue Job out of it. Once Elihu's words ring true the Lord Himself appears to Job, Job repents, and is saved.
Job's circumstantial captivity is turned when he prays for his "friends" those perhaps well-meaning but massively misinformed counselors.