fix concurrent writes

this handles the case where

```js
// a.js
write('<script src="analytics-a.js">');

// b.js
write('<script src="analytics-b.js">');

// mine.js
replace('analytics-a');
replace('analytics-b');
load('a.js');
load('b.js');
```

but there's still a problem, if `write()` isn't called in `a.js` or `b.js` (or both) `wait()` will keep waiting, so not sure, maybe we should have a timeout or something ?

cc @calvinfo maybe you have some ideas :D