Flush stdout after writing, for real time output.