tests: Resolve Coverity RESOURCE_LEAK
tests: Resolve Coverity RESOURCE_LEAK

The 'lib' handle will be leaked if 'dlsym' condition fails.
So close the handle before return.

Signed-off-by: Wang Rui <efd73d5b5867bcfd66553912fa090c7d92d260b7@huawei.com>

nertpinx/libvirt,VenkatDatta/libvirt,datto/libvirt,jfehlig/libvirt,jardasgit/libvirt,libvirt/libvirt,rlaager/libvirt,fabianfreyer/libvirt,eskultety/libvirt,andreabolognani/libvirt,rlaager/libvirt,andreabolognani/libvirt,andreabolognani/libvirt,shugaoye/libvirt,libvirt/libvirt,fabianfreyer/libvirt,VenkatDatta/libvirt,datto/libvirt,datto/libvirt,eskultety/libvirt,agx/libvirt,zippy2/libvirt,taget/libvirt,libvirt/libvirt,jardasgit/libvirt,fabianfreyer/libvirt,olafhering/libvirt,VenkatDatta/libvirt,nertpinx/libvirt,elmarco/libvirt,eskultety/libvirt,crobinso/libvirt,datto/libvirt,andreabolognani/libvirt,andreabolognani/libvirt,taget/libvirt,rlaager/libvirt,taget/libvirt,zippy2/libvirt,jfehlig/libvirt,VenkatDatta/libvirt,crobinso/libvirt,fabianfreyer/libvirt,jardasgit/libvirt,elmarco/libvirt,nertpinx/libvirt,agx/libvirt,jardasgit/libvirt,eskultety/libvirt,libvirt/libvirt,zippy2/libvirt,crobinso/libvirt,olafhering/libvirt,olafhering/libvirt,crobinso/libvirt,rlaager/libvirt,shugaoye/libvirt,olafhering/libvirt,nertpinx/libvirt,VenkatDatta/libvirt,datto/libvirt,jfehlig/libvirt,elmarco/libvirt,agx/libvirt,taget/libvirt,agx/libvirt,nertpinx/libvirt,rlaager/libvirt,jardasgit/libvirt,taget/libvirt,shugaoye/libvirt,elmarco/libvirt,zippy2/libvirt,shugaoye/libvirt,eskultety/libvirt,jfehlig/libvirt,shugaoye/libvirt,fabianfreyer/libvirt,elmarco/libvirt,agx/libvirt