In this teshuva that is the next subsection of the compendium that included the previous teshuva on heart transplants, Rav Waldenberg considers the case of assisting in the death of someone who is a goseis (is close to death) and would be better served by being put out of his misery, and perhaps is even requesting to be put out of his misery.
On a simple level, Rav Waldenberg rules that we may not do so, based on the Gemara in Shabbat mentioned in the previous teshuva and as codified by the Aruch HaShulchan, with the logic that we are not masters of our own bodies, and therefore none of us have the right to request the death of another, or even of ourselves.
Rav Waldenberg cites two cases that prove this. The first is the death of Rabi Chanina ben Teradyon, who was burned alive by the Romans while wrapped in a Torah, and with wet wool put over his heart to slow his death. Rather than let his students remove the wool to hasten the death, Rabi Chanina had the Roman officer remove it, since his students were not allowed to do anything to speed up his death, even though doing so would shorten his agony. The second case brought is that of David HaMelech killing the Amaleki who had killed Shaul HaMelech. Even though Shaul had requested that the Amaleki kill him so as to bring his death about quickly, nevertheless David held the Amaleki (who according to several commentaries was actually Jewish – see Shmuel Bet 1) liable for the murder.
Furthermore, based on a Gemara in Sotah we learn that prolonging someone’s life is considered to be meritorious, even if that life is a difficult and painful one. As such, no one has the right to take his own life or allow someone to do so in order to put himself out of his misery.