code: private void handleWriteException(Throwable ex) {
          if (ex instanceof ObjectClosedException && !this.closed.get()) {
              log.warn("{}: Caught ObjectClosedException but not closed; closing now.", this.traceObjectId, ex);
              close();
          }
      }
docs: Handles a general Write exception.