Turns out the cause of this problem wasn't exactly what I thought it was. We don't have to reimplement TemporaryDirectory.  I'm still not entirely clear on *what* causes this but it's not what I thought.