     # Atom <= 1.6
     Promise.resolve atom.getStorageFolder().load(key)
 
+closeAllBuffers = () ->
+  buffer?.release() for buffer in atom.project.getBuffers()
+
 exports.switchToProject = (item) ->
   new Promise (resolve) ->
     # Get current state key


    # Save the state of the current project
    saveCurrentState().then () ->

      # HACK: Tab bar doesn't unsubscribe; memory leak
      tabs = atom.packages.getActivePackage("tabs")
      if tabs
        tabBarView.unsubscribe() for tabBarView in tabs.mainModule.tabBarViews

      # Load the state of the new project
      loadState(newKey).then (state) ->

exports.closeProject = () ->
  # Save the state of the current project
  saveCurrentState().then () ->
    # Set project paths
    atom.project.setPaths([])

    # Close all buffers
    closeAllBuffers()

    # TODO: Should we close the tree-view?
    treeViewPack = atom.packages.getActivePackage("tree-view")
