Fix bug with IOError in tornado-proxy when application sends error