Flush stdout to prevent buffering.