diff --git a/airbyte-cdk/bulk/toolkits/load-s3/src/main/kotlin/io/airbyte/cdk/load/file/s3/S3MultipartUpload.kt b/airbyte-cdk/bulk/toolkits/load-s3/src/main/kotlin/io/airbyte/cdk/load/file/s3/S3MultipartUpload.kt index f65f88a70688..2e87550fb94b 100644 --- a/airbyte-cdk/bulk/toolkits/load-s3/src/main/kotlin/io/airbyte/cdk/load/file/s3/S3MultipartUpload.kt +++ b/airbyte-cdk/bulk/toolkits/load-s3/src/main/kotlin/io/airbyte/cdk/load/file/s3/S3MultipartUpload.kt @@ -81,10 +81,8 @@ class S3MultipartUpload( inner class UploadStream : OutputStream() { override fun close() = runBlocking { - workQueue.send { - if (closeOnce.setOnce()) { - workQueue.close() - } + if (closeOnce.setOnce()) { + workQueue.send { workQueue.close() } } }