public function end_progress() {
        if (!count($this->descriptions)) {
            throw new \coding_exception('end_progress() without start_progress()');
        }
        array_pop($this->descriptions);
        array_pop($this->maxes);
        array_pop($this->currents);
        $parentcount = array_pop($this->parentcounts);
        if (!empty($this->descriptions)) {
            $lastmax = end($this->maxes);
            if ($lastmax != self::INDETERMINATE) {
                $lastvalue = end($this->currents);
                $this->currents[key($this->currents)] = $lastvalue + $parentcount;
            }
        }
        $this->update_progress();
    }