Do a null check to see if the main window has been initiated when shutting down.
Fix for bug 2800517.
Authored by: jimwinston 2009-06-03
Parent: [r475]
Child: [r477]