 quit = ->
     global.forceClose = true
     # force all windows to close
-    aboutWindow.destroy()
-    mainWindow.destroy()
+    aboutWindow.destroy() if aboutWindow?
+    mainWindow.destroy() if mainWindow?
     app.quit()
     return
 

        client.on n, (e) ->
            ipcsend n, e

    # Emitted when about window is about to close and prevents it,
    #  instead it hides the window.
    aboutWindow.on 'close', (ev) ->
        aboutWindow.hide()
        ev.preventDefault()
        return false

    # Emitted when the window is about to close.
    # Hides the window if we're not force closing.
    #  IMPORTANT: moved to app.coffee

        titleBarStyle: 'hidden-inset' if process.platform is 'darwin'
        # autoHideMenuBar : true unless process.platform is 'darwin'
    }

    # and load the index.html of the app. this may however be yanked
    # away if we must do auth.
