     @openPathOnEvent('application:open-license', path.join(process.resourcesPath, 'LICENSE.md'))
 
     app.on 'before-quit', =>
+      @saveState() if @hasEditorWindows()
       @quitting = true
 
     app.on 'will-quit', =>

        if loadSettings = window.getLoadSettings()
          states.push(initialPaths: loadSettings.initialPaths)
    @storageFolder.store('application.json', states)

  loadState: ->
    if (states = @storageFolder.load('application.json'))?.length > 0


  # Public: Removes the {AtomWindow} from the global window list.
  removeWindow: (window) ->
    if @windows.length is 1
      @applicationMenu?.enableWindowSpecificItems(false)
      if process.platform in ['win32', 'linux']
        app.quit()
        return
    @windows.splice(@windows.indexOf(window), 1)
    @saveState() unless window.isSpec or @quitting

  # Public: Adds the {AtomWindow} to the global window list.
