better file descriptor hygiene
better file descriptor hygiene

Chrome build running flex got hung in a fd write.
Started cleaning up this code to make it easier to analyze,
found that doing so fixed the build anyway.

dendy/ninja,fuchsia-mirror/third_party-ninja,justinsb/ninja,glensc/ninja,guiquanz/ninja,curinir/ninja,autopulated/ninja,jimon/ninja,nafest/ninja,pathscale/ninja,kimgr/ninja,metti/ninja,ninja-build/ninja,rjogrady/ninja,dabrahams/ninja,automeka/ninja,hnney/ninja,colincross/ninja,maruel/ninja,automeka/ninja,jcfr/ninja,kimgr/ninja,drbo/ninja,ThiagoGarciaAlves/ninja,ehird/ninja,guiquanz/ninja,jcfr/ninja,nicolasdespres/ninja,nickhutchinson/ninja,colincross/ninja,SByer/ninja,martine/ninja,chenyukang/ninja,fifoforlifo/ninja,AoD314/ninja,nocnokneo/ninja,ignatenkobrain/ninja,kimgr/ninja,yannicklm/ninja,lizh06/ninja,ThiagoGarciaAlves/ninja,Qix-/ninja,rnk/ninja,kissthink/ninja,sxlin/dist_ninja,ninja-build/ninja,atetubou/ninja,PetrWolf/ninja,ninja-build/ninja,nafest/ninja,tfarina/ninja,mutac/ninja,ignatenkobrain/ninja,hnney/ninja,okuoku/ninja,ilor/ninja,tychoish/ninja,maximuska/ninja,AoD314/ninja,mohamed/ninja,sgraham/ninja,drbo/ninja,TheOneRing/ninja,jhanssen/ninja,pathscale/ninja,mutac/ninja,maximuska/ninja,ndsol/subninja,Maratyszcza/ninja-pypi,chenyukang/ninja,maruel/ninja,vvvrrooomm/ninja,curinir/ninja,mgaunard/ninja,mydongistiny/ninja,lizh06/ninja,jcfr/ninja,dorgonman/ninja,Ju2ender/ninja,jendrikillner/ninja,sorbits/ninja,jsternberg/ninja,moroten/ninja,autopulated/ninja,ThiagoGarciaAlves/ninja,vvvrrooomm/ninja,martine/ninja,jimon/ninja,jhanssen/ninja,mydongistiny/ninja,pcc/ninja,ikarienator/ninja,jendrikillner/ninja,yannicklm/ninja,dendy/ninja,colincross/ninja,sgraham/ninja,cipriancraciun/ninja,ilor/ninja,bmeurer/ninja,metti/ninja,mathstuf/ninja,mohamed/ninja,maruel/ninja,synaptek/ninja,PetrWolf/ninja-main,bradking/ninja,mathstuf/ninja,juntalis/ninja,ignatenkobrain/ninja,mydongistiny/ninja,martine/ninja,dabrahams/ninja,sorbits/ninja,maruel/ninja,fifoforlifo/ninja,bmeurer/ninja,liukd/ninja,autopulated/ninja,dorgonman/ninja,dpwright/ninja,drbo/ninja,tfarina/ninja,ignatenkobrain/ninja,synaptek/ninja,nafest/ninja,jsternberg/ninja,hnney/ninja,jimon/ninja,mgaunard/ninja,ikarienator/ninja,lizh06/ninja,nicolasdespres/ninja,mathstuf/ninja,ndsol/subninja,metti/ninja,sxlin/dist_ninja,synaptek/ninja,tfarina/ninja,rnk/ninja,ndsol/subninja,ctiller/ninja,colincross/ninja,pcc/ninja,ehird/ninja,dpwright/ninja,bmeurer/ninja,sxlin/dist_ninja,pcc/ninja,SByer/ninja,Maratyszcza/ninja-pypi,mgaunard/ninja,justinsb/ninja,dendy/ninja,nickhutchinson/ninja,syntheticpp/ninja,barak/ninja,Ju2ender/ninja,atetubou/ninja,dorgonman/ninja,dpwright/ninja,sxlin/dist_ninja,Ju2ender/ninja,bradking/ninja,nico/ninja,Qix-/ninja,PetrWolf/ninja,nico/ninja,nornagon/ninja,moroten/ninja,pck/ninja,tychoish/ninja,AoD314/ninja,jendrikillner/ninja,LuaDist/ninja,autopulated/ninja,hnney/ninja,atetubou/ninja,iwadon/ninja,juntalis/ninja,ThiagoGarciaAlves/ninja,kissthink/ninja,Maratyszcza/ninja-pypi,PetrWolf/ninja-main,atetubou/ninja,maximuska/ninja,jimon/ninja,metti/ninja,sgraham/ninja,vvvrrooomm/ninja,sxlin/dist_ninja,pck/ninja,nocnokneo/ninja,jsternberg/ninja,moroten/ninja,yannicklm/ninja,glensc/ninja,Ju2ender/ninja,drbo/ninja,Qix-/ninja,iwadon/ninja,purcell/ninja,PetrWolf/ninja-main,Qix-/ninja,SByer/ninja,purcell/ninja,mohamed/ninja,SByer/ninja,yannicklm/ninja,sorbits/ninja,kissthink/ninja,fifoforlifo/ninja,syntheticpp/ninja,dabrahams/ninja,okuoku/ninja,rjogrady/ninja,ikarienator/ninja,justinsb/ninja,bradking/ninja,nornagon/ninja,sgraham/ninja,mohamed/ninja,vvvrrooomm/ninja,LuaDist/ninja,ctiller/ninja,kimgr/ninja,jhanssen/ninja,TheOneRing/ninja,tychoish/ninja,dpwright/ninja,ehird/ninja,bradking/ninja,mdempsky/ninja,LuaDist/ninja,mathstuf/ninja,Maratyszcza/ninja-pypi,mdempsky/ninja,rjogrady/ninja,ukai/ninja,cipriancraciun/ninja,jcfr/ninja,moroten/ninja,PetrWolf/ninja-main,bmeurer/ninja,sorbits/ninja,liukd/ninja,chenyukang/ninja,ehird/ninja,purcell/ninja,barak/ninja,rjogrady/ninja,automeka/ninja,mutac/ninja,ilor/ninja,barak/ninja,ninja-build/ninja,dendy/ninja,glensc/ninja,nicolasdespres/ninja,okuoku/ninja,nicolasdespres/ninja,pathscale/ninja,nocnokneo/ninja,liukd/ninja,pathscale/ninja,TheOneRing/ninja,automeka/ninja,PetrWolf/ninja,nickhutchinson/ninja,nico/ninja,iwadon/ninja,mgaunard/ninja,ukai/ninja,rnk/ninja,jhanssen/ninja,juntalis/ninja,guiquanz/ninja,curinir/ninja,mdempsky/ninja,pck/ninja,mutac/ninja,fuchsia-mirror/third_party-ninja,sxlin/dist_ninja,dorgonman/ninja,martine/ninja,lizh06/ninja,ctiller/ninja,rnk/ninja,TheOneRing/ninja,fifoforlifo/ninja,liukd/ninja,chenyukang/ninja,jendrikillner/ninja,PetrWolf/ninja,glensc/ninja,justinsb/ninja,kissthink/ninja,nornagon/ninja,cipriancraciun/ninja,ndsol/subninja,curinir/ninja,cipriancraciun/ninja,pck/ninja,tychoish/ninja,tfarina/ninja,nafest/ninja,guiquanz/ninja,nickhutchinson/ninja,purcell/ninja,barak/ninja,pcc/ninja,dabrahams/ninja,ilor/ninja,ikarienator/ninja,LuaDist/ninja,synaptek/ninja,mdempsky/ninja,AoD314/ninja,fuchsia-mirror/third_party-ninja,nocnokneo/ninja,maximuska/ninja,fuchsia-mirror/third_party-ninja,iwadon/ninja,ukai/ninja,juntalis/ninja,okuoku/ninja,jsternberg/ninja,syntheticpp/ninja,ukai/ninja,syntheticpp/ninja,sxlin/dist_ninja,ctiller/ninja,nico/ninja,nornagon/ninja,mydongistiny/ninja