code: public void close() {
      if (this.isDisabled || this.closed) {
        // parent stream needs to check for success explicitly
        return;
      }
      closed = true;
      try {
        // send close request
        tasks.add(sendExecutor.submit(new SendWorker(
            new ByteArrayOutputStream(0), segmentId++, true)));
  
        // wait for all tasks to complete
        for (Future<Void> task : tasks) {
          task.get();
        }
      } catch (InterruptedException e) {
        setErrorStatus("Interrupted exception", e);
      } catch (ExecutionException e) {
        setErrorStatus("Execution exception", e);
      } finally {
        // close the executor
        sendExecutor.shutdownNow();
      }
    }
docs: Close the upload