     # 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

              unless tvState.hasFocus
                atom.workspace.getActivePane().activate()
        else
          # Close all buffers
          buffer?.destroy() for buffer in atom.project.buffers

          # Set project paths
          atom.project.setPaths(item.paths)

        # HACK[Pigments]: Pigments needs to reload on project reload
        pigments = atom.packages.getActivePackage("pigments")

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")
