TST: Always try to close file descriptors of tempfiles

We weren't closing the file descriptors from `mkstemp`, which caused fun
segmentation faults for me. This should fix the issue.