Catch WriteStream error and emit