docs: public void closeAsync() throws IOException {
          if (anyAreSet(state, FLAG_CLOSED) || servletRequestContext.getOriginalResponse().isTreatAsCommitted()) {
              return;
          }
          if (!servletRequestContext.getExchange().isInIoThread()) {
              servletRequestContext.getExchange().getIoThread().execute(new Runnable() {
                  @Override
                  public void run() {
                      try {
                          closeAsync();
                      } catch (IOException e) {
                          UndertowLogger.REQUEST_IO_LOGGER.closeAsyncFailed(e);
                      }
                  }
              });
              return;
          }
          try {
  
              setFlags(FLAG_CLOSED);
              clearFlags(FLAG_READY);
              if (allAreClear(state, FLAG_WRITE_STARTED) && channel == null) {
  
                  if (servletRequestContext.getOriginalResponse().getHeader(Headers.TRANSFER_ENCODING_STRING) == null) {
                      if (buffer == null) {
                          servletRequestContext.getOriginalResponse().setHeader(Headers.CONTENT_LENGTH, "0");
                      } else {
                          servletRequestContext.getOriginalResponse().setHeader(Headers.CONTENT_LENGTH, Integer.toString(buffer.position()));
                      }
                  }
              }
              createChannel();
              if (buffer != null) {
                  if (!flushBufferAsync(true)) {
                      return;
                  }
  
                  if (pooledBuffer != null) {
                      pooledBuffer.close();
                      buffer = null;
                  } else {
                      buffer = null;
                  }
              }
              channel.shutdownWrites();
              setFlags(FLAG_DELEGATE_SHUTDOWN);
              if (!channel.flush()) {
                  channel.resumeWrites();
              }
          } catch (IOException | RuntimeException | Error e) {
              if (pooledBuffer != null) {
                  pooledBuffer.close();
                  pooledBuffer = null;
                  buffer = null;
              }
              throw e;
          }
      }