I am running Ubuntu 14.04 LTS and notice that if I have top running in a shell and use the "Open to LAN" feature of Minecraft in single player world, running in OpenJDK/JRE 7, launcher version 1.6.44, MC Version 1.8.9, then the game will exit normally and not freeze up. I usually set other players mode as spectator, but there are no other players on my LAN, and set the cheats on because I use the gamemode command to change mode. I have tried this twice, and it has worked fine both times. I do not know the intricacies of top, but understand that it is like the task manager in MS Windows. I hope this helps to resolve the isssue.
I got around this problem by enabling cheats at world generation time. Since I am playing only singleplayer, I do not need to open to LAN and just wanted to be able to enter command to change game mode and difficulty. I do not like to cheat but view cheats as just a way for a singleplayer to access some additional functionality. CAVEAT: Anything with great potential has an equal likelihood of great exploitation by others.