code: public synchronized void close() throws InterruptedException {
          if (!state.isAlive()) {
              if (LOG.isDebugEnabled()) {
                  LOG.debug("Close called on already closed client");
              }
              return;
          }
  
          if (LOG.isDebugEnabled()) {
              LOG.debug("Closing session: 0x" + Long.toHexString(getSessionId()));
          }
  
          try {
              cnxn.close();
          } catch (IOException e) {
              if (LOG.isDebugEnabled()) {
                  LOG.debug("Ignoring unexpected exception during close", e);
              }
          }
  
          LOG.debug("Session: 0x" + Long.toHexString(getSessionId()) + " closed");
      }
docs: Close this client object. Once the client is closed, its session becomes
  invalid. All the ephemeral nodes in the ZooKeeper server associated with
  the session will be removed. The watches left on those nodes (and on
  their parents) will be triggered.
  
  @throws InterruptedException