Fix tests without tmpdir
Some tests write files and check their existence without using a temporary working directory. This lead to tests passing even though they should be failing because of interaction with other files.
Solution: All file system writes by tests should use tmpdir