Actually Mozart was very afraid of death. He died quite young and during his last days he was commissioned by a Count in Vienna to write a Requiem which he did with a dark assumption that the messenger of the Count is a harbinger of his death which was near. Listen to Mozart's Requiem
Then Beethoven courted death when he was turning deaf. Music was everything to him and how frustrating it must have been for him to discover at the prime of his musical career that he is losing the sense of hearing. A musician turning deaf is like a surgeon who cannot hold a scalpel because his hands tremor or like an orator who cannot speak ! Beethoven thought of suicide and wrote a will which is famously known as Heligenstadt testament ..
.http://en.wikipedia.org/wiki/Heiligenstadt_Testament ...
he actually changed his mind after a visit to a countryside and celebrated by writing the Sixth symphony which I believe is his best. A movie on Beethvoen called Immortal Beloved
Rossini, Bach and Handel also wrote several mass to be performed during burial ceremony in church.