http: fix `http.ClientRequest#write` callback

This also fixes `http.ClientRequest#end`.

fixes #5729