Make sure Git resources are released before git_libgit2_shutdown
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.
This is a port of LHCb!4032 (merged)