TMPDIR is not always defined in the environment but the code doesn't check
for that. Let's used std::tmpfile instead.
Maybe an easier fix is to perform the tmpdir lookup better, but that is
also noisy since the search for a decent tmpdir is based on lore.
std::tmpfile() is rather clean. However it does not leave a nice filename
name around for debugging, so I understand why it might not be preferred.
Fixes#495