[libvirt] ESX [11/12]: Reorder some function calls to avoid potential virDomainPtr leaks