[FIXED JENKINS-18011] Deadlock issue with slaves on Windows

...The error occures if we have several threads trying to write the output from the screen as well as when a slave has been running for a longer period with a lot of output. The problem was verified to exist in Jenkins LTS 1.509.1 and can reproduced with a overload plugin https://github.com/hanabishi/jenkins-overload. Used to work around [JENKINS-18011](https://issues.jenkins-ci.org/browse/JENKINS-18011).

(Supersedes #665.)