OK. I (have to) suppose that what is actually happening is that we have two different timers that pass through this code and so marking the first as activated still lets the second thread activate the second one.
So I'll add a lock around the file test....done. I'll let it run for a while before posting a PR.