During restart tests, there could be two copies of a WorkflowRun in waitForCompletion at once.
This could lead to duplicated or mangled text being sent to the main log.
Check explicitly for Jenkins shutdown and break out of wFC in this case (also closing the log stream).