[windows] Close the socket event only after stopping its ObjectWatcher.
[windows] Close the socket event only after stopping its ObjectWatcher.

Before, the socket event could be closed before the ObjectWatcher that watches
the socket event is stopped. If the socket event is closed while the wait is still pending,
according to the docs on RegisterWaitForSingleObject, the function's behavior is undefined.

This is a speculative fix for a chromedriver crash, in which the thread waiting
on the socket event throws an exception with status waiting on invalid handle (referring to the socket event).
At the same time, the IO thread stack looks like:
UnregisterWaitEx
chromedriver!base::win::ObjectWatcher::StopWatching
chromedriver!net::StreamListenSocket::UnwatchSocket
chromedriver!net::StreamListenSocket::CloseSocket
chromedriver!net::StreamListenSocket::~StreamListenSocket
BUG=chromedriver:573

Review URL: https://codereview.chromium.org/60853003

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@236401 0039d316-1c4b-4281-b951-d872f2087c98

Fireblend/chromium-crosswalk,Just-D/chromium-1,dushu1203/chromium.src,ondra-novak/chromium.src,dushu1203/chromium.src,Pluto-tv/chromium-crosswalk,krieger-od/nwjs_chromium.src,hgl888/chromium-crosswalk-efl,axinging/chromium-crosswalk,chuan9/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,jaruba/chromium.src,Just-D/chromium-1,hgl888/chromium-crosswalk-efl,jaruba/chromium.src,dednal/chromium.src,TheTypoMaster/chromium-crosswalk,patrickm/chromium.src,Jonekee/chromium.src,patrickm/chromium.src,ltilve/chromium,Just-D/chromium-1,axinging/chromium-crosswalk,ondra-novak/chromium.src,littlstar/chromium.src,ondra-novak/chromium.src,TheTypoMaster/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,PeterWangIntel/chromium-crosswalk,littlstar/chromium.src,chuan9/chromium-crosswalk,fujunwei/chromium-crosswalk,hgl888/chromium-crosswalk,anirudhSK/chromium,Chilledheart/chromium,hgl888/chromium-crosswalk,Pluto-tv/chromium-crosswalk,ChromiumWebApps/chromium,M4sse/chromium.src,markYoungH/chromium.src,M4sse/chromium.src,Pluto-tv/chromium-crosswalk,M4sse/chromium.src,dednal/chromium.src,TheTypoMaster/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,Jonekee/chromium.src,krieger-od/nwjs_chromium.src,jaruba/chromium.src,axinging/chromium-crosswalk,Chilledheart/chromium,Just-D/chromium-1,krieger-od/nwjs_chromium.src,Chilledheart/chromium,bright-sparks/chromium-spacewalk,Fireblend/chromium-crosswalk,Chilledheart/chromium,hgl888/chromium-crosswalk-efl,anirudhSK/chromium,Fireblend/chromium-crosswalk,dushu1203/chromium.src,Jonekee/chromium.src,ltilve/chromium,dushu1203/chromium.src,Jonekee/chromium.src,anirudhSK/chromium,hgl888/chromium-crosswalk-efl,littlstar/chromium.src,ltilve/chromium,ltilve/chromium,krieger-od/nwjs_chromium.src,Fireblend/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,dednal/chromium.src,ltilve/chromium,fujunwei/chromium-crosswalk,axinging/chromium-crosswalk,krieger-od/nwjs_chromium.src,chuan9/chromium-crosswalk,krieger-od/nwjs_chromium.src,ondra-novak/chromium.src,hgl888/chromium-crosswalk-efl,bright-sparks/chromium-spacewalk,fujunwei/chromium-crosswalk,ChromiumWebApps/chromium,anirudhSK/chromium,Fireblend/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,crosswalk-project/chromium-crosswalk-efl,littlstar/chromium.src,markYoungH/chromium.src,dednal/chromium.src,patrickm/chromium.src,krieger-od/nwjs_chromium.src,hgl888/chromium-crosswalk,chuan9/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,axinging/chromium-crosswalk,jaruba/chromium.src,bright-sparks/chromium-spacewalk,krieger-od/nwjs_chromium.src,patrickm/chromium.src,markYoungH/chromium.src,Chilledheart/chromium,fujunwei/chromium-crosswalk,ChromiumWebApps/chromium,patrickm/chromium.src,fujunwei/chromium-crosswalk,jaruba/chromium.src,Chilledheart/chromium,mohamed--abdel-maksoud/chromium.src,axinging/chromium-crosswalk,M4sse/chromium.src,ChromiumWebApps/chromium,bright-sparks/chromium-spacewalk,crosswalk-project/chromium-crosswalk-efl,PeterWangIntel/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,dednal/chromium.src,Fireblend/chromium-crosswalk,jaruba/chromium.src,TheTypoMaster/chromium-crosswalk,axinging/chromium-crosswalk,M4sse/chromium.src,jaruba/chromium.src,ChromiumWebApps/chromium,chuan9/chromium-crosswalk,PeterWangIntel/chromium-crosswalk,Pluto-tv/chromium-crosswalk,anirudhSK/chromium,M4sse/chromium.src,Just-D/chromium-1,littlstar/chromium.src,axinging/chromium-crosswalk,hgl888/chromium-crosswalk-efl,markYoungH/chromium.src,Just-D/chromium-1,crosswalk-project/chromium-crosswalk-efl,PeterWangIntel/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,anirudhSK/chromium,mohamed--abdel-maksoud/chromium.src,ondra-novak/chromium.src,chuan9/chromium-crosswalk,Chilledheart/chromium,patrickm/chromium.src,M4sse/chromium.src,dushu1203/chromium.src,Just-D/chromium-1,Jonekee/chromium.src,crosswalk-project/chromium-crosswalk-efl,markYoungH/chromium.src,axinging/chromium-crosswalk,markYoungH/chromium.src,Pluto-tv/chromium-crosswalk,littlstar/chromium.src,hgl888/chromium-crosswalk,M4sse/chromium.src,ondra-novak/chromium.src,PeterWangIntel/chromium-crosswalk,bright-sparks/chromium-spacewalk,hgl888/chromium-crosswalk-efl,anirudhSK/chromium,Chilledheart/chromium,axinging/chromium-crosswalk,ltilve/chromium,hgl888/chromium-crosswalk,mohamed--abdel-maksoud/chromium.src,Pluto-tv/chromium-crosswalk,hgl888/chromium-crosswalk,krieger-od/nwjs_chromium.src,chuan9/chromium-crosswalk,dednal/chromium.src,ChromiumWebApps/chromium,ondra-novak/chromium.src,dushu1203/chromium.src,Fireblend/chromium-crosswalk,jaruba/chromium.src,Fireblend/chromium-crosswalk,ondra-novak/chromium.src,crosswalk-project/chromium-crosswalk-efl,ChromiumWebApps/chromium,hgl888/chromium-crosswalk,patrickm/chromium.src,mohamed--abdel-maksoud/chromium.src,patrickm/chromium.src,fujunwei/chromium-crosswalk,Pluto-tv/chromium-crosswalk,axinging/chromium-crosswalk,bright-sparks/chromium-spacewalk,anirudhSK/chromium,Jonekee/chromium.src,M4sse/chromium.src,mohamed--abdel-maksoud/chromium.src,ondra-novak/chromium.src,dednal/chromium.src,mohamed--abdel-maksoud/chromium.src,dednal/chromium.src,crosswalk-project/chromium-crosswalk-efl,dushu1203/chromium.src,Pluto-tv/chromium-crosswalk,hgl888/chromium-crosswalk-efl,ChromiumWebApps/chromium,mohamed--abdel-maksoud/chromium.src,TheTypoMaster/chromium-crosswalk,fujunwei/chromium-crosswalk,littlstar/chromium.src,ltilve/chromium,TheTypoMaster/chromium-crosswalk,dushu1203/chromium.src,M4sse/chromium.src,dushu1203/chromium.src,bright-sparks/chromium-spacewalk,hgl888/chromium-crosswalk,hgl888/chromium-crosswalk,ChromiumWebApps/chromium,Jonekee/chromium.src,PeterWangIntel/chromium-crosswalk,markYoungH/chromium.src,markYoungH/chromium.src,jaruba/chromium.src,Just-D/chromium-1,M4sse/chromium.src,hgl888/chromium-crosswalk-efl,Just-D/chromium-1,krieger-od/nwjs_chromium.src,dednal/chromium.src,jaruba/chromium.src,Jonekee/chromium.src,TheTypoMaster/chromium-crosswalk,ChromiumWebApps/chromium,markYoungH/chromium.src,Jonekee/chromium.src,littlstar/chromium.src,krieger-od/nwjs_chromium.src,Jonekee/chromium.src,markYoungH/chromium.src,Fireblend/chromium-crosswalk,jaruba/chromium.src,Jonekee/chromium.src,dushu1203/chromium.src,Pluto-tv/chromium-crosswalk,crosswalk-project/chromium-crosswalk-efl,chuan9/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,ltilve/chromium,anirudhSK/chromium,ChromiumWebApps/chromium,chuan9/chromium-crosswalk,Chilledheart/chromium,dushu1203/chromium.src,bright-sparks/chromium-spacewalk,fujunwei/chromium-crosswalk,TheTypoMaster/chromium-crosswalk,anirudhSK/chromium,markYoungH/chromium.src,dednal/chromium.src,anirudhSK/chromium,ltilve/chromium,PeterWangIntel/chromium-crosswalk,fujunwei/chromium-crosswalk,ChromiumWebApps/chromium,anirudhSK/chromium,hgl888/chromium-crosswalk-efl,dednal/chromium.src,patrickm/chromium.src,bright-sparks/chromium-spacewalk