code: private void close(T stream) {
  
          // Attempt to close stream
          try {
              stream.close();
          }
          catch (IOException e) {
              logger.warn("Unable to close intercepted stream: {}", e.getMessage());
              logger.debug("I/O error prevented closure of intercepted stream.", e);
          }
  
          // Notify waiting threads that the stream has ended
          synchronized (stream) {
              stream.notify();
          }
  
      }
docs: Closes the given stream, logging any errors that occur during closure.
  The monitor of the stream is notified via a single call to notify() once
  the attempt to close has been made.
  
  @param stream
  The stream to close and notify.