ensure buffered output gets written before returning from notifyClosedOutput