types: fix path handling in node key tests (#7493) (#7502)
These tests use a deterministic and unseeded random source to generate
non-colliding filenames for testing. When testing locally, this means tests are
not hermetic from one run to the next.
Use proper temp directories, and clean up after they're done.
(cherry picked from commit 5f85c8f536)
Co-authored-by: M. J. Fromberger <fromberger@interchain.io>