Fix test on Win32 by draining filehandle before waiting for subprocess to finish

I know you have a different implementation that works, but it involves a lot more code.  I think this is a better fix.