flush stdout after outputting