It is mentioned in other parts of the forum that when someone dies, their mind recreates a final reality as a type of egregore. If a person believes in a JCI version of heaven and hell, that is the ultimate reality that is generated when the soul leaves the body.
In certain books like the Tibetan Book of the Dead and the Egyptian Book of the Dead, the rituals and meditations had to be memorized so a person would be “ready” when their death finally came. They would be able to remember what to do at the time of death as they lose consciousness.
This article that I’m referring to would show that science verifies what was stated above.