Fix test to actually wait until program writes to file.