get_file_to_upload_from_index(): fixed possible shared file reference leak.