docs: function closeProject(projectId, callback) {
              var prevBranchName = state.branchName;
              state.project = null;
              state.projectAccess = null;
              state.projectInfo = null;
              state.readOnlyProject = false;
              //TODO what if for some reason we are in transaction?
              storage.closeProject(projectId, function (err) {
                  if (err) {
                      callback(err);
                      return;
                  }
  
                  state.core = null;
                  state.branchName = null;
                  state.commitHash = null;
                  //self.dispatchEvent(null);
                  state.patterns = {};
                  //state.gHash = 0;
                  state.nodes = {};
                  state.loadNodes = {};
                  state.loadError = 0;
                  state.rootHash = null;
                  //state.rootObject = null;
                  state.transactions.opened = 0;
                  state.transactions.callbacks = [];
                  state.msg = '';
  
                  cleanUsersTerritories();
                  if (prevBranchName) {
                      self.dispatchEvent(CONSTANTS.BRANCH_CLOSED, prevBranchName);
                  }
  
                  self.dispatchEvent(CONSTANTS.BRANCH_CHANGED, null);
                  self.dispatchEvent(CONSTANTS.PROJECT_CLOSED, projectId);
  
                  callback(null);
              });
          }