Add fallback for tempfile(1)

Since it's not guaranteed to be available.

Fixes #2.