Updated scanner module

Added exception handling (try/except/else) for condition testing file
lines to catch an IndexError caused by extra lines added for random
reasons at end of text file. Even if everything ran correctly and the
new files contents are written as expected, that error can scare people.