Fix recently-introduced crash on double-terminating the Writer thread.