weird stuff
output.flush() fixed it not writing files

if you close the display window it would write, but not if you hit stop
button