Fixing bug about not having ' 0\n' at the end of the result file

Thanks to Martin Maurer for reporting this.

Fixes #208