docs: public void close() throws IOException {
          if (servletRequestContext.getOriginalRequest().getDispatcherType() == DispatcherType.INCLUDE ||
                  servletRequestContext.getOriginalResponse().isTreatAsCommitted()) {
              return;
          }
          if (listener == null) {
              if (anyAreSet(state, FLAG_CLOSED)) return;
              setFlags(FLAG_CLOSED);
              clearFlags(FLAG_READY);
              if (allAreClear(state, FLAG_WRITE_STARTED) && channel == null && servletRequestContext.getOriginalResponse().getHeader(Headers.CONTENT_LENGTH_STRING) == null) {
                  if (servletRequestContext.getOriginalResponse().getHeader(Headers.TRANSFER_ENCODING_STRING) == null
                          && servletRequestContext.getExchange().getAttachment(HttpAttachments.RESPONSE_TRAILER_SUPPLIER) == null
                          && servletRequestContext.getExchange().getAttachment(HttpAttachments.RESPONSE_TRAILERS) == null) {
                      if (buffer == null) {
                          servletRequestContext.getExchange().getResponseHeaders().put(Headers.CONTENT_LENGTH, "0");
                      } else {
                          servletRequestContext.getExchange().getResponseHeaders().put(Headers.CONTENT_LENGTH, Integer.toString(buffer.position()));
                      }
                  }
              }
              try {
                  if (buffer != null) {
                      writeBufferBlocking(true);
                  }
                  if (channel == null) {
                      channel = servletRequestContext.getExchange().getResponseChannel();
                  }
                  setFlags(FLAG_DELEGATE_SHUTDOWN);
                  StreamSinkChannel channel = this.channel;
                  if (channel != null) { //mock requests
                      channel.shutdownWrites();
                      Channels.flushBlocking(channel);
                  }
              } catch (IOException | RuntimeException | Error e) {
                  IoUtils.safeClose(this.channel);
                  throw e;
              } finally {
                  if (pooledBuffer != null) {
                      pooledBuffer.close();
                      buffer = null;
                  } else {
                      buffer = null;
                  }
              }
          } else {
              closeAsync();
          }
      }