After Job says "I relent and find comfort on dust and ashes," the Lord turns to Eliphaz "I'm angry with you and your friends who have not spoken the truth about me as did Job."
The test is over. Job is returned to his life as it had been.
When Job emerges from his tragedy, he able to pray for his friends--I presume this means the ones who had been badgering him and trying to correct him throughout the book.
He died old--at 140, twice the length of what was expected in Psalm 90:10.
Many commentators think that this section was added by a different source from most of the book of Job. These verses seem to be a reaffirmation of the Deuteronomic theory of blessings as rewards for right behavior in contrast to verses 1-6 in this chapter.
Modern commentators try to reconcile both understandings by saying that whichever we hold, that God is present in our bad times and our good. We may make bad choices or bad things may happen despite our good ones, but God is still with us. And, our recognition of God's presence can help us through our difficult times.
And some commentators interpret the book of Job as an allegory on the exile.