Added error checking for App Engine queries when building download results files, as well as a count for retrying failed queries and a 1-second delay between retries.