Make copy_file_from_url more robust.