The prime goal is to alleviate suffering, and not to prolong life. And if your treatment does not alleviate suffering, but only prolongs life, that treatment should be stopped.
I no longer teach law. But when I did I advised my students that they should never accept a case if it meant that by doing so you couldn't sleep at night.