The deaths of John Proctor, Rebecca Nurse, and Martha Corey more or less bring an end to the Salem witch trials. The judges are so eager to get Proctor to confess and thereby exonerate the two women because they know that the people are growing tired of all the trials and executions. Even Rev. Parris fears that the execution of Proctor and Goody Nurse will turn public sentiment against the trials. That is exactly what happened, and when the governor's wife was accused of witchcraft, it was the final straw. He called a halt to the trials.
The Un Museum web page on the trials has this to say about Salem:
What happened at Salem lay as an open wound in the Massachusetts colony for many years. In 1697 the General Court ordered a day of fasting and soul-searching for what had happened at Salem. Samuel Sewall, who was one of the judges, publicly confessed to his error and guilt in the fraudulent convictions. Nine years later Ann Putnam Jr., one of the "afflicted girls," publicly apologized for her part in the tragedy. The village of Salem, prompted by the shadow of the trials, renamed itself to Danvers in 1752. Finally, in 1957, the State of Massachusetts formally apologized for the events of 1692.
Ultimately, those people did not die in vain. They serve as an example of what can happen when public hysteria gets the better of common sense.
This is not a question that has a definite answer. It is up to the reader to decide. Personally, the fact that John Proctor felt that his dying would win back his good name is relevant. Surely there were those who witnessed Proctor and Rebecca Nurse's refusal to confess and realize the insanity that had taken over the town. If their actions changed just a few minds, then there is good in their sacrifice.
It was also apparently necessary for both Rebecca Nurse and Proctor to die without giving in. The fact that death was preferable to lying shows that they are more concerned with integrity and the state of their souls, than merely sparing their lives.