(Maint) Make tmp directory more safely

Because the temp directory is not immediately created with the discovered name,
there might be a race condition between tests running on the same machine.