Fixed bug where last test in a file sometimes were generated twice