@Override
    public CompletableFuture<Void> close() {
        if (closeCf != null) {
            return closeCf;
        }

        if (objectPart != null) {
            // force upload the last part which can be smaller than minPartSize.
            objectPart.upload();
            objectPart = null;
        }

        S3ObjectStats.getInstance().objectStageReadyCloseStats.record(timerUtil.elapsedAs(TimeUnit.NANOSECONDS));
        closeCf = new CompletableFuture<>();
        CompletableFuture<Void> uploadDoneCf = uploadIdCf.thenCompose(uploadId -> CompletableFuture.allOf(parts.toArray(new CompletableFuture[0])));
        FutureUtil.propagate(uploadDoneCf.thenCompose(nil -> operator.completeMultipartUpload(writeOptions, path, uploadId, genCompleteParts())), closeCf);
        closeCf.whenComplete((nil, ex) -> {
            S3ObjectStats.getInstance().objectStageTotalStats.record(timerUtil.elapsedAs(TimeUnit.NANOSECONDS));
            S3ObjectStats.getInstance().objectNumInTotalStats.add(MetricsLevel.DEBUG, 1);
            S3ObjectStats.getInstance().objectUploadSizeStats.record(totalWriteSize.get());
        });
        return closeCf;
    }
The minPartSize represents the minimum size of a part for a multipart object.
s3stream/src/main/java/com/automq/stream/s3/operator/MultiPartWriter.java