The halacha requires us to close our eyes when davening Shmoneh Esrei. It is brought in the Seforim that if one closes their eyes during Shmoneh Esrei, when they die they will be Zocheh to see the Shechina. However if one keeps their eyes open (not looking in a siddur) when they die they will see the truly gruesome site of the Malach HaMaves. Why is this crucial moment dependent on Shmoneh Esrei?
The purpose of this world is to mask Hashem's presence and tempts us with false pleasures. Our job is to see past all this and discover Hashem's presence within the world. Only this can give a person real pleasure. Those who indulge themselves in this world never learn to recognize true pleasure. Their lives are an endless pursuit of Olam Hazeh. Yet there are those who see past the fallacy of this world and its false pleasures and instead turn their attention to discovering Hashem in this world, fostering a relationship with Him despite all the distractions. They get a taste of Olam Haba while still here.
The moment of death is a transition from a world of illusion to the world of truth where nothing exists other than the presence of Hashem. For some people death means the end. They are cruelly ripped away from the only world they know how to exist in, the world of illusion. The moment of death is their scary end. They don't see anything they recognize in their new environment and only see what they left behind and can no longer be a part of. They see the Malach HaMaves, the most horrid end of all ends, as they become prisoners in their dark grave trying to figure out how to get out.
For those who have spent their lives trying to catch a glimpse of Olam Haba, death is not death at all. It is the moment when the curtain is removed and all that they've strived to achieve their entire lives becomes a reality in their new found paradise. They find themselves in the pure presence of a Hashem.
A telltale sign of what is to come can be seen by the way a person davens Shmoneh Esrei. Shmoneh Esrei is an audience with Hashem that we are granted three times a day. Those who recognize the true pleasure of connecting with Hashem close their eyes and block out the distractions of this world and focus on the opportunity to connect to a world beyond. Those whose whole lives revolve around material pursuits cannot shut their eyes on the world they know and love. How can they when their vision sees nothing beyond their lowly earthly surroundings?