Fixed problem with reading input query.log
- needed to add an additional try-except to infile exaustion