Close puzzle file after use, general code cleanup