When you quit a singleplayer world, the game will recognize you as "gone" for a little while before the chunks unload. It's also possible that when entering, the chunks load before the game recognizes you as "there", there is no way to tell the difference. This is very annoying when having command blocks check for players online, they will register no players online when you quit the world. To replicate, just hook up a testfor command to a 20 Hz clock, then quit and re-enter the world. The command will momentarily not find you.
Linked issues
Comments 7
This is perfectly logical, considering that singleplayer runs a server internally. When you quit, you leave the world, and then it shuts down the server. Why would you want it to shut down the server first? You'd probably get a message that you were disconnected from the server then.
I guess I can get behind that explanation. It still seems a little odd. The problem with it is that it can mess with redstone mechanisms. I actually had to redesign some stuff due to this bug.
Probably a duplicate of MC-409.