extra::tempfile: replace mkdtemp with an RAII wrapper

this incidentally stops `make check` from leaving directories in `/tmp`
extra::tempfile: some tests for behavior on unwinding