Add tmpdir* and dir argument to mktemp to control location of temporary files