fixed issue with S3 creating an incomplete file when there is an internal server error on the last chunk