Test temp file cleanup

The tests used to create a file in the local directory. This has been replaced with a tempfile.