Refactored expection

Raplaced Exception with NullReferenceException when there actually is a
NullReferenceException.
Improved exit behavior

Added a Quit method. Modified "File > Quit" to use this method. Also
added another event handler that handles the red X in the upper right
corner, also uses Quit.