Simple bug fix

Added null check to onClose to prevent crash when the program is started and closed without starting the overlay.