Attempt to fix the NPE caused by quitting

Signed-off-by: Steven Downer <grinch@outlook.com>
Merge pull request #7 from Grinch/master

Attempt to fix the NPE caused by quitting