public synchronized void close() {
    if (isClosed) {
      return;
    }
    isClosed = true;
    if (cycLeaseManager != null) {
      cycLeaseManager.interrupt();
    }
    if (cycConnection != null) {
      cycConnection.close();
    }
    if (areAPIRequestsLoggedToFile) {
      try {
        apiRequestLog.close();
      } catch (IOException e) {
        System.err.println("error when closing apiRequestLog: " + e.getMessage());
      }
    }
    cycAccessInstances.remove(Thread.currentThread());
    // make sure it's not every used again for setting as the 'current' CycAccess.
    for (Map.Entry<String, CycAccess> entry : currentCycAccesses.entrySet()) {
      if (entry.getValue().equals(this)) {
         currentCycAccesses.remove(entry.getKey());
      }
    }
    /*if (sharedCycAccessInstance == null || sharedCycAccessInstance.equals(this)) {
    final Iterator iter = cycAccessInstances.values().iterator();
    if (iter.hasNext())
    sharedCycAccessInstance = (CycAccess) iter.next();
    else
    sharedCycAccessInstance = null;
    }*/
  }