Check _output_array flag in api.web.RequestHandler.write_error

In some cases RequestHandler._output would be set to the wrong type.