This reworks how the correct 'stdout' stream to use by default
for functions like color_print, ProgressBar, etc. is obtained.

Usually we just want to use sys.stdout, but on Windows that does
not work for color.  Previously there were some hacks to instead
use IPython's stdio stream on Windows since it actually wraps
pyreadline and *does* handle colors.  However, by *always* using
IPython's stdout, functions that assume we're using sys.stdout
do not actually write properly to sys.stdout when sys.stdout is
*changed* (e.g. replaced with a log file).

This instead uses sys.stdout by default in *most* cases.  But when
sys.stdout is set to a TTY (the only context where we probably want
to keep colors) *then* it switches over to using IPython's stdout.

An alternative might be to create a wrapper object that handles
this more transparently, but for now this appears to work.
Add changelog entries for both issues fixed by this PR. [skip ci]
Merge pull request #2878 from embray/issue-2878

Table.pprint() header ignores stdout redirection