fix: Handle upload error correctly

This aborts the S3 upload when an error occurs. Without this code the connection to S3 wouldn't be closed and it ends in an unhandled "socket hang up" exception.