   removeWindow: (window) ->
     @windows.splice @windows.indexOf(window), 1
     @applicationMenu?.enableWindowSpecificItems(false) if @windows.length is 0
+    @saveState()
 
   # Public: Adds the {AtomWindow} to the global window list.
   addWindow: (window) ->

      window.browserWindow.once 'closed', =>
        @lastFocusedWindow = null if window is @lastFocusedWindow
        window.browserWindow.removeListener 'focus', focusHandler

  # Creates server to listen for additional atom application launches.
  #

    app.on 'window-all-closed', ->
      app.quit() if process.platform in ['win32', 'linux']

    app.on 'will-quit', =>
      @killAllProcesses()
      @deleteSocketFile()
