Flush file handles at the end, since Python 3 won't do it for us.