Flush stdout before _exit()

fixes #6852
refs #6820