public function close() {
        global $CFG;
        require_once($CFG->libdir . '/filelib.php');

        $writer = new MoodleODSWriter($this->worksheets);
        $contents = $writer->get_file_content();

        send_file($contents, $this->filename, 0, 0, true, true, $writer->get_ods_mimetype());
    }