Make sure Git resources are released before git_libgit2_shutdown ((@clemenci)
It may happen (in some error condition) that finalize() is skipped, in which case the Git resources might not be released before ~GitEntityResolver, so it's important to ensure they are released to avoid a segfault.
Backported from !4032 (merged)