code: protected boolean closeAtomically() {
          if (isClosed.compareAndSet(false, true)) {
              Closeable.closeQuietly(networkStatsListener);
              return true;
          } else {
              //was already closed.
              return false;
          }
      }
docs: Close the connection atomically.
  
  @return true if state changed to closed; false if nothing changed.