replace tmpnam() with mkstemp()

mkstemp() lets you create a tmp file anywwhere, so we do it in audio_file_dir.

This is a manual patch from my old fork.
Fixes #13
Fixes #19
Fixes #39
Fixes #43
Fixes #44