Add missing dlclose on error path (taken from LibreOffice tree)