Flush stdout regularly for better log output