Fixed not closing potentially closed resource in S3 uploader