Breaking out of event thread on exit, and fixing memory issue
Cleaning up shut down