When the tee body contains more then one statement, then the file is always corrupted. This means that the file cannot be opened, or deleted until the slave is restarted. This is closely related to JENKINS-54346 but is not the same problem!
When tee only contains one statement, the problem does not occur
This is a very critical issue because the job will fail the second time on cleanWs() and will continue to fail until the slave is restarted.
The problem does not occur on Linux
Splitting the tee comment so it contains only one statement works as well:
Notice that on Linux:
Leads to a_file having 'Terminated' as last line? Thats also a bit strange