fix event order of selenium file download

There appeared to be a race condition where `end` could fire, but the file wasn't completely written to disk yet. This change appears to fix that. I tested it 50 times against 0.10.24 and 50 times against 0.8.25. Before this change I could usually see the error 1 out of 15 times on either version.