func CloseInstance(id uint64) uint64 {
	mutex.Lock()
	defer mutex.Unlock()

	count := uint64(0)
	if ins, ok := instances[id]; ok {
		ins.openCount--
		count = ins.openCount
		if count == 0 {
			if ins.policyClient != nil {
				ins.policyClient.Close()
			}
			if ins.accessLogger != nil {
				ins.accessLogger.Close()
			}
			delete(instances, id)
		}
		log.Debugf("CloseInstance(%d): Remaining open count: %d", id, count)
	} else {
		log.Debugf("CloseInstance(%d): Not found (closed already?)", id)
	}
	return count
}
// Close returns the new open count
Close returns the new open count
// Close returns the new open count
func CloseInstance(id uint64) uint64 {
	mutex.Lock()
	defer mutex.Unlock()
	count := uint64(0)
	if ins, ok := instances[id]; ok {
		ins.openCount--
		count = ins.openCount
		if count == 0 {
			if ins.policyClient != nil {
				ins.policyClient.Close()
			}
			if ins.accessLogger != nil {
				ins.accessLogger.Close()
			}
			delete(instances, id)
		}
		log.Debugf("CloseInstance(%d): Remaining open count: %d", id, count)
	} else {
		log.Debugf("CloseInstance(%d): Not found (closed already?)", id)
	}
	return count
}
func CloseInstance ( id uint64 ) uint64 { mutex . Lock ( ) defer mutex . Unlock ( ) count := uint64 ( 0 ) if ins , ok := instances [ id ] ; ok { ins . openCount -- count = ins . openCount if count == 0 { if ins . policyClient != nil { ins . policyClient . Close ( ) } if ins . accessLogger != nil { ins . accessLogger . Close ( ) } delete ( instances , id ) } log . Debugf ( " " , id , count ) } else { log . Debugf ( " " , id ) } return count }
Close returns the new open count
Close returns the new open count