Fixed access to the writer in case of an error in BaseHttpServlet

The previous code generated an exception when the OutputStream was got by the code prior to an error