Latest updates.

- Use the 'with' keyword to protect files that you open. This way, the fclose() is automatically called even if something goes wrong.
- When you read through a file, there is a 'pointer' for the file, which points to a position to read from the file. After you were reading through the file for the first combination, you had pushed the pointer to the end of the file, and not reset it. Then for following combinations, the pointer was already at the end of the file, so there were no more lines read. This caused the first combination to work, then all the others to produce 0-length files.