extra::tempfile: replace mkdtemp with an RAII wrapper

this incidentally stops `make check` from leaving directories in `/tmp`