Ensure outputs are always flushed immediately.

We re-open stdout without buffering (there are other solutions, but this
is a one-liner; see [1]).  Then flush calls in the code are not necessary.

[1] http://stackoverflow.com/questions/107705/python-output-buffering