net/http: fix TimeoutHandler data races; hold lock longer

The existing lock needed to be held longer. If a timeout occured
while writing (but after the guarded timeout check), the writes
would clobber a future connection's buffer.

Also remove a harmless warning by making Write also set the
flag that headers were sent (implicitly), so we don't try to
write headers later (a no-op + warning) on timeout after we've
started writing.

Fixes Issue 8414
Fixes Issue 8209

LGTM=ruiu, adg
R=adg, ruiu
CC=golang-codereviews
https://codereview.appspot.com/123610043