[bf7135428c] Restore the Tcl_Write() return value logic.
backport those tests that can be