Issue #12451: Open files in binary mode in some tests when the text file is not
needed.

Remove also an unused variable (blank) in test_threading.
5 files changed