Fixed cyclic shared pointers.
Implemented basic game shutdown mechanics.