BF: fix for failed file deletion in Windows

Windows refuses to delete a file still open in a Python object.