TaskServlet properly returns 500 on exceptions now

Fixing TaskServlet to properly return 500 when an exception is thrown by a Task. Exceptions were only being handled after the output stream was being closed, which results in Jetty committing the response and disallowing further modification (e.g. sending an error.)