In my opinion, John Proctor is "right with God" when he makes his final decision. He has by this time apologized to his wife for his sin against her and she in turn has apologized for keeping a cold house. Of course he has petty sins that Parris would deem necessary of restitution like poor church attendance, but these are of ill-importance to the man Proctor is and has become.
Proctor is relieved of the sin in his affair. He will not heap on top of that freedom from sin, the sin of a lie. This lie is what the magistrates are asking him to tell. They want him to confess to the crime of witchcraft, something he has not even done. Even the pastors try to get him to say the lie knowing it's a lie just to spare his life for the sake of his wife. Because he will not do this he will die. Thus, he is content to die because of a righteous act. Even in the magistrates still see him as a sinner, they are ignorant of the truth. If all the God-stuff of Puritan theology is true he would be going to heaven anyway, a better place.
His wife, although pregnant and a mother of other sons, is happy for John in his contentment with his righteous relationship with God. She will miss his help terribly raising these boys. These boys will miss having a father. The town, in turn, will see the irrationality and the hysteria these girls caused adults to have.