Solitude does not necessarily mean living apart from others; rather, it means never living apart from one's self. It is not about the absence of other people, it is about being fully present to ourselves, whether or not we are with others.
Naturally, most of us would like to die a peaceful death, but it is clear that we cannot hope to die peacefully if our lives have been full of violence, or if our minds have mostly been agitated by emotions like anger, attachment, or fear. So if we wish to die well, we must learn how to live well: Hoping for a peaceful death, we must cultivate peace in our mind, and in our way of life.