code: void close() throws RepositoryException {
          mLock.lock();
          if (mClosed) {
              mLock.unlock();
              return;
          }
   
          Map<Class<?>, CursorList<TransactionImpl<Txn>>> cursors;
          try {
              cursors = mCursors;        
  
              // Ensure that map is freed promptly. Thread-local reference to
              // this scope otherwise keeps map and its contents lingering around
              // for a very long time.
              mCursors = null;
  
              while (mActive != null) {
                  mActive.exit();
              }
          } finally {
              // Swap TransactionManager out with a dummy one, to allow the
              // original one to get freed.
              mTxnMgr = (TransactionManager<Txn>) TransactionManager.Closed.THE;
              mClosed = true;
              mLock.unlock();
          }
  
          // Close cursors without lock held, to prevent deadlock. Cursor close
          // operation might acquire its own lock, which in turn acquires a lock
          // on this scope.
          if (cursors != null) {
              for (CursorList<TransactionImpl<Txn>> cursorList : cursors.values()) {
                  cursorList.closeCursors();
              }
          }
      }
docs: Exits all transactions and closes all cursors. Should be called only
  when repository is closed.