         console.log("Killing process #{pid} failed: #{error.code ? error.message}")
     delete @pidsToOpenWindows[pid]
 
-  saveState: ->
+  saveState: (allowEmpty=false) ->
     return if @quitting
     states = []
     for window in @windows
       unless window.isSpec
         if loadSettings = window.getLoadSettings()
           states.push(initialPaths: loadSettings.initialPaths)
-    @storageFolder.store('application.json', states)
+    if states.length > 0 or allowEmpty
+      @storageFolder.store('application.json', states)
 
   hasEditorWindows: ->
     @windows.some (window) -> not window.isSpec

    @openPathOnEvent('application:open-license', path.join(process.resourcesPath, 'LICENSE.md'))

    app.on 'before-quit', =>
      @saveState() if @hasEditorWindows()
      @quitting = true

    app.on 'will-quit', =>

        app.quit()
        return
    @windows.splice(@windows.indexOf(window), 1)
    @saveState(true) unless window.isSpec

  # Public: Adds the {AtomWindow} to the global window list.
  addWindow: (window) ->
