In Act Four of The Crucible, Proctor decides to confess to engaging in witchcraft in order to protect his family and to avoid dying like a martyr. Confessing will enable him to go on living, to raise children with Elizabeth, and to start anew in their marriage.
However, when Proctor is asked to testify that others in the community have engaged in witchcraft, he refuses to do so, knowing that falsely naming names will only further spread the paranoia and reinforce the witch hunt. This is the first sign that Proctor is regaining his sense of integrity; he is unwilling to crush the lives of others in order to save himself.
Proctor ultimately signs his confession but refuses to give the paper to Danforth, ripping it up and choosing to accept his execution instead. Proctor does not wish for his family to endure the stigma attached to a witchcraft confession. He realizes that all that remains is his good name and that he cannot live without that, claiming:
...I do think I see some shred of goodness in John Proctor. Not enough to weave a banner with, but white enough to keep it from such dogs.
Refusing to give into the "pleasure" of the courts, Proctor stands strong in the truth--that he has not engaged in witchcraft--and goes to the gallows with his integrity intact.
John Proctor initially confesses to protect his wife. Just as she lied to try to save his, neither is successful. Proctor does not want to leave his wife and make her unhappy again, but in the end he cannot go through with it.
Proctor refuses to name names to help take the heat off of him. He has had scorn for those who have done this, and he refuses to participate in any further harm to innocent people, even to save his own life.
Proctor cannot give the paper to Danforth because all he has left is his name, or reputation. He has spent most of the play as a lost soul because of his infidelity with Abigail, but he has a chance at redemption by not giving in to the temptation to save his life.
Proctor makes the choice that will end his life, but will save his soul.