Close file descriptors before unlinking

Unlinking a file before closing may not be supported on non-POSIX systems such as Windows. This allows more tests to run to completion.

`test_collection.test_openReadOnly` and the cleanup function in `utils.tmpdir` still error because of unlinking-before-closing, likely because sqlite does not close the file upon closing the DB, but I am not certain this is the case.