protected void ensureOpen() throws IOException {
        if (closed) {
            throw new IOException(ERROR_STREAM_CLOSED);
        }
    }
Wraps the given output stream.

@param output          output stream
@param bufferSize      buffer size which is always greater than zero(usually
                       4096 or larger)
@param compression     compression algorithm, null or
                       {@link ClickHouseCompression#NONE} means no
                       compression
@param level           compression level
@param postCloseAction custom action will be performed right after closing
                       the output stream
@return wrapped output, or the same output if it's instance of
        {@link ClickHouseOutputStream}
clickhouse-data/src/main/java/com/clickhouse/data/ClickHouseOutputStream.java