As soon as the lungs stop and no more oxygen is coming in and the heart stops so no blood is moving around the body, cells start dying, because they no longer have the fuel necessary for operation (most of the energy needed is derived from food). With cells no longer working, no more heat is produced. The energy in the body, mostly in the form of heat, then slowly transfers out to other things around it—usually the air.
Live cells are required in order for thinking to occur. Again, when brain cells die, they stop passing signals around the brain and the body. It’s like no one is minding the store, so everything else stops, too—heart, lungs, etc. More cells die, and slowly lose heat. Well, they can quickly lose heat if you’re drowning in water around the North Pole.
Anyway, no energy for cells, no electricity for thinking, etc and you no longer have a human being. You just have a bunch of carbon, oxygen, and hydrogen (mostly) losing it’s organization. So no more person.
I’m not sure what kind of organized energy the character in your book was labeling as a ghost. All I know is that no one has ever proposed a hypothesis describing the traits of a ghost that has been supported by any evidence. I’m sure if someone were trying to measure some kind of “energy,” we’d have a detector that could measure that much energy. I mean, we can detect the smallest of quarks.
It is possible that there is organized energy out there (ghosts) that we have never detected or somehow become aware of. However, we generally do not consider unreproducible evidence (a person’s personal experience) to be helpful in science. In science, our standard for evidence is, among other things, it must be reproducible. That is, an independent researcher can duplicate your finding.
Thus there is no scientific evidence for magical things. There is only people’s individual experience. And, as we all know, people experience things that aren’t there all the time. Ghosts may exist. Unicorns may exist. Invisible pink dragons may exist. No one can tell you for sure they don’t. But there also isn’t a shred of scientific evidence for any of those things. I don’t know about you, but I prefer to operate using knowledge that has good evidence to support it.