Added checking for solution to end of generator.

This slows down the generation of puzzles but guarantees a solution for
the user.