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.
501024
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();
        }
    }
395526
def is_closing(self) -> bool:
        
        return self.stream.closed() or self.client_terminated or self.server_terminated
186526
private void close()
    {
        assert (fd != null);

        try {
            fd.close();
            socket.eventClosed(endpoint, fd);
        }
        catch (IOException e) {
            socket.eventCloseFailed(endpoint, ZError.exccode(e));
        }
        fd = null;
    }
1311417
@Override
  public void close() throws IOException
  {
    Socket s = _s;
    _s = null;

    OutputStream os = _os;
    _os = null;

    InputStream is = _is;
    _is = null;

    try {
      if (os != null)
        os.close();
      
      if (is != null)
        is.close();
    } finally {
      if (s != null)
        s.close();
    }
  }
1239524
@Override
  public void close() throws IOException {
    checkState(isInitialized, "initialize() must be invoked before use.");
    if (isOpen()) {
      try {
        pipeSinkChannel.close();
        handleResponse(waitForCompletionAndThrowIfUploadFailed());
      } finally {
        pipeSinkChannel = null;
        uploadOperation = null;
      }
    }
  }
412976
public void close() throws java.io.IOException{
        synchronized(this){
            if(_outHelper.isOutputStream_closed()){
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "output stream close previously completed ...return ");
                }
                return;
            }
            else{
                _outHelper.closeWork();
            }
        }
    }
719188
@Override
    public void close() throws IOException {
        if (isClosed()) {
            return;
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Closing stream: hc: " + this.hashCode() + " details: " + this);
        }
        this.closed = true;
        this.ignoreFlush = false;
        try {
            flushBuffers();
        } finally {
            // must release the buffers even if the flush fails
            clear();
        }
    }
339989
@Override
    public void close()
        throws IOException
    {
        InputStream in = _inputSource;

        if (in != null) {
            _inputSource = null;
            if (_autoClose) {
                in.close();
            }
        }
        freeBuffers();
    }
864247
@Override
	public void close() throws IOException {

		// enforce sequential close() calls
		synchronized (CLOSE_MUTEX) {
			this.recordWriter.close(new HadoopDummyReporter());

			if (this.outputCommitter.needsTaskCommit(this.context)) {
				this.outputCommitter.commitTask(this.context);
			}
		}
	}
355447
@Override
    public void close() {
        if (!this.closed) {
            this.closed = true;

            // If we have already returned a result but it hasn't been consumed yet, cancel it.
            CompletableFuture<ReadResultEntryContents> lastReturnedFuture = this.lastEntryFuture;
            if (lastReturnedFuture != null && !lastReturnedFuture.isDone()) {
                lastReturnedFuture.cancel(true);
                this.lastEntryFuture = null;
            }

            log.trace("{}.ReadResult[{}]: Closed.", this.traceObjectId, this.streamSegmentStartOffset);
        }
    }
267014
@Override
    public void close() throws IOException {
        if (!closed) {
            try {
                if (!eof) {
                    exhaustInputStream(this);
                }
            } finally {
                eof = true;
                closed = true;
            }
        }
    }
1109965
@Override
  public void close() throws IOException {
    if (out != null) {
      try {
        long startTime = System.nanoTime();
        out.close();
        long duration = System.nanoTime() - startTime;
        ghfs.increment(GoogleHadoopFileSystemBase.Counter.WRITE_CLOSE);
        ghfs.increment(GoogleHadoopFileSystemBase.Counter.WRITE_CLOSE_TIME, duration);
        long streamDuration = System.nanoTime() - initTime;
        ghfs.increment(GoogleHadoopFileSystemBase.Counter.OUTPUT_STREAM);
        ghfs.increment(GoogleHadoopFileSystemBase.Counter.OUTPUT_STREAM_TIME, streamDuration);
        logger.atFine().log("close(%s)", gcsPath);
      } finally {
        out = null;
        channel = null;
      }
    }
  }
97466
@Override
    public synchronized void close() {
        if (currentStatus != StreamStatus.CLOSED) {
            // Only flush the print stream: don't close it.
            currentPrintStream.flush();

            if (!LoggingFileUtils.tryToClose(currentPrintStream)) {
                LoggingFileUtils.tryToClose(currentFileStream);
            }

            // Send to bit bucket again-- this holder is done (false -- do not replace)
            setStreamStatus(StreamStatus.CLOSED, null, null, DummyOutputStream.psInstance);
        }
    }
692063
public void close() throws IOException {
        if (dataStream != null) dataStream.close();
        byteStream = null;
        dataStream = null;
    }
381163
@Override
    public final void close() {
        if (this.inputStream != null) {
            try {
                this.inputStream.close();
            } catch (IOException ioe) {
                logger.error("Unable to close output stream.", ioe);
            } finally {
                this.inputStream = null;
            }
        }

        dispose();
    }
33269
@Override
    public void close() throws IOException
    {
        if (out != null)
        {
            out.close();
            out = null;
        }
        if (in != null)
        {
            in.close();
            in = null;
        }
    }
1015085
def _Close(self):
    """"""
    self._fsntfs_data_stream = None
    self._fsntfs_file_entry = None

    self._file_system.Close()
    self._file_system = None