An adaptive controller for the administration of closed-circuit anesthesia during spontaneous and assisted ventilation