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 Jira issue JENKINS-18011.