Use tmpDir when creating new files

Wasn't sure why tmpDir wasn't working till I dug into the code and saw it wasn't actually being used anywhere.