Fix CLOUDSTACK-2525: clean up db entries in vm_template and
template_store_ref in case of template creation failure.