Use a generator to read file

This allows the use of a 'with' statement so the file will be safely
closed.