Clean up broken pipe edge-case in worker thread