TST: close open files

Fix 7 test errors on Windows of the following type: `PermissionError: [WinError 32] The process cannot access the file because it is being used by another process`