Saint Joseph with Jesus
The Catholic Way of Dying. ''Of all human evils death is the most grievous, by which human life is destroyed..''. St. Thomas Aquinas, Compendium theologiae, lib. 1 cap.227.
First a definition: death is the separation of the soul from the body, a phenomenon we can't know has happened with moral certainty until corruption has begun. "Death" does not mean the cessation of breathing or heartbeat, nor does "brain death" mean that death has occured. The soul isn't "in" the heart, or "in" the lungs, or "in the brain, or "in" any particular part of the body. The treatment of the dying, the apparently dead, and their organs is goverened by this Truth.
Now, a person confronting death should receive the Sacrament of Unction for the possible restoration of body (His will be done) and, most importantly, soul. This is of prime importance and should never be neglected.