tests: only unlink tmp file if it exists