Lib/util.py fixup: Made print_error and friends thread-safe
Lib/util.py fixup: Made print_error and friends thread-safe

From Python documentation:

https://docs.python.org/3.6/library/io.html#multi-threading

TextIOWrapper subclasses (such as sys.stdour and sys.stderr) are not
thread-safe. They need to be guarded with locks. I did some digging and
forum discussions show this.  The buffer can get corrupted when printing
from multiple threads (or worse -- rare exceptions can be raised).

This closes #1595.

fyookball/electrum,fyookball/electrum,fyookball/electrum