jsonhttp: safer handlers

Two fixes to make things safer from corrupt output.

1) We change HandleJSON so that its handlers no longer
get access to the http.ResponseWriter, which means they
can't mix the normal JSON output up with other output.

2) We change HandleErrors so that it doesn't attempt
to write an error if the headers have already been written.