Cleanup of blank lines
Replaced use of file() by open() and make sure file is properly closed afterwards
Fixed PuzzleFormatError to inherit from Exception