       win.close()
       windows[i] = null
   closeWindow: (win) ->
-    forceClose = true
-    win.on 'closed', (e) ->
-      forceClose = false
+    pluginUnload = true
     win.close()
   rememberMain: ->
     win = global.mainWindow

          current.setFullScreen(false)
        else
          current.hide()
        e.preventDefault() unless forceClose
    # Draggable
    unless options.navigatable
      current.webContents.on 'will-navigate', (e) ->

forceClose = false
state = []  # Window state before hide
hidden = false
pluginUnload = false

module.exports =
  createWindow: (options) ->
