     @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

      @deleteSocketFile()

    app.on 'will-exit', =>
      @saveState() if @hasEditorWindows()
      @killAllProcesses()
      @deleteSocketFile()

