code: private void maybeCloseS3Client(String reason) {
          LOG.debug("Decremented S3 client reference count for " + reason);
  
          if (_stashReaderRefCount.decrementAndGet() == 0) {
              LOG.debug("Closing S3 client for StashFileSystem at " + _uri);
              _s3.shutdown();
          }
      }
docs: Closes the S3 client if it is completely dereferenced.  This is necessary because Hadoop may close the file
  system while a stream returned by {@link #open(org.apache.hadoop.fs.Path, int)} is still open.