avoid deadlock in ConsoleOut.systemOutOverwrite

System.out can be reset after being captured by `val lockObject`.
Then locking `lockObject` and calling `println()` could lead to a
deadlock.