Fix timeout issue during an S3 upload
Fix tests after change flush_writes method