I have read that a brain continues to function even after the heart is stopped. I think that a dead person's brain takes little time to stop it's functionality. During this period there is possibility of dreaming. I don't think that all people who had near death experiences have had these dreams. These dreams are just dreams, not real. Certain state of a brain can cause dreams.
This is a short form of my research based on my personal experience. A human being is always living with a group of spirits which have joined one by one since birth. Between creatures (including human beings) and God there are millions of invisible elements. There are divisions too. We are just robots made of different materials (flesh, bones, nerves etc.,) created by scientist God or eternal beings to entertain God. Each of us have memories like computers have RAM. The fed things (data= knowledge=several spirits or invisible elements) are in contact with the mind since childhood. A brain is a media to connect spirits to a human mind. In fact, all things (knowledge, skills, feelings, emotions, interests and everything) related to a human being lives with a human being in the form spirits. Even thoughts are not our own. One after another the spirits think and we choose (accept) or reject based on the knowledge we have possessed. If current (electricity) stopped the memory loses all data. This is with the computer. The same thing occurs to all of us. Computers are functioning by electric power but human beings are functioning by natural power. We call this as soul. This soul is nothing but simply the functionality of body. If this is stopped our memories lose all data (all spirits or invisible elements). These spirits leave the body and go to different places. No one lives in the form of spirit or anything after death. We are simply our bodies, the toys made for spirits for their games.
After death no one is going to be anything. Can you remember what all happened to you when you were a baby? You forget everything very soon. Even at the age of six, you don't know what happened to you when you were a baby. We are still new born babies. What you see in you, may be changes of intelligence or changes of behaviour, manners etc., whatever may be, are spirits - real spirits. That's why certain people during their deadly accidents lose everything and remains like a baby. During these accidents, the extremity of shock drives the spirits away from the body or contact. Their behaviour changes or go back to a level according to the number of spirits they have lost. After death all becomes nothing.
There is no hell or heaven for human beings. They are only for spirits. Spirits are separate elements. We are like other creatures except that we have an additional sense (sixth sense). This sense had changed only the living conditions of the human beings but not the fate. The fate is almost same to all creatures including human beings.
REINCARNATION
Reincarnation is a rare phenomena which is not possible to all. To form a reincarnation all spirits which lived with a body must possess another person together. Then only he/she can feel same thing of the demised person. But this is not happening because the spirits never stay together to haunt or possess another. They go to different bodies. Rarely there might have been certain cases but I think it had changed after some time. Spirits in their life time live with many bodies (one after another). Their memories sometimes affects the person. This is natural. This is not enough to believe that there is rebirth. No one returns after death. A human's life ends with a single body.