Handle clients closing the request and immediately reopening

This fixes HandlingClose.test_abort_xhr_polling and
test_abort_xhr_streaming in the sockjs-protocol test suite.