code: void release() {
      long references = --this.references;
      if (!state.active() && references == 0) {
        context.sessions().unregisterSession(id);
        log.release(id);
        if (closeIndex > 0) {
          log.release(closeIndex);
        }
      }
    }
docs: Releases a reference to the session.