Fixes unclosed file issue on windows, and another issue that was uncovered related to closing lucene snapshots without commits in them.