More reliable use of #copy_to_local_file which should work with S3.