Move utility functions out of for-loop
Attempt to handle timeout failures during S3->FTP transfer
Connect to S3 only after the FTP filelist has been generated