Let's hack!

Implemented fixes for instability introduced as a result of fixing the closeEvent handling in order to clean up resources.

Particularly interested in any thoughts on line 384.. ;)