public synchronized CompletableFuture<Void> close() {
            CompositeByteBuf buf = ByteBufAlloc.compositeByteBuffer();
            for (DataBlock block : waitingUploadBlocks) {
                buf.addComponent(true, block.buffer());
                completedBlocks.add(block);
            }
            waitingUploadBlocks.clear();
            indexBlock = new IndexBlock();
            buf.addComponent(true, indexBlock.buffer());
            Footer footer = new Footer(indexBlock.position(), indexBlock.size());
            buf.addComponent(true, footer.buffer());
            writer.write(buf.duplicate());
            size = indexBlock.position() + indexBlock.size() + footer.size();
            return writer.close();
        }
Create a new object writer.

@param objectId           object id
@param objectStorage      S3 operator
@param blockSizeThreshold the max size of a block
@param partSizeThreshold  the max size of a part. If it is smaller than {@link Writer#MIN_PART_SIZE}, it will be set to {@link Writer#MIN_PART_SIZE}.
@param writeOptions       the object storage write options
s3stream/src/main/java/com/automq/stream/s3/ObjectWriter.java