Fixed unit tests writing to root

`tmpnam()` returns a unique filename for the current working directory,
even though the returned path starts with a `/` or `\`.