Fixed stderr writes in a worker subprocess causing a deadlock (#1207)