def handle_closed_task(self, task_name, record):
        """
        Do everything needed when a task is closed

        Params:
            task_name (str): name of the task that is finishing
            record (logging.LogRecord): log record with all the info

        Returns:
            None
        """
        if task_name not in self.tasks:
            return

        if self.main_failed:
            self.mark_parent_tasks_as_failed(self.cur_task)

        if self.tasks[task_name].failed:
            record.msg = ColorFormatter.colored('red', END_TASK_ON_ERROR_MSG)
        else:
            record.msg = ColorFormatter.colored('green', END_TASK_MSG)

        record.msg += ' (in %s)' % self.tasks[task_name].elapsed_time()

        if self.should_show_by_depth() or self.tasks[task_name].force_show:
            if self.tasks[task_name].force_show:
                self.handle_error()

            self.pretty_emit(record, is_header=True)

        self.close_children_tasks(task_name)
        self.tasks.pop(task_name)
Do everything needed when a task is closed

        Params:
            task_name (str): name of the task that is finishing
            record (logging.LogRecord): log record with all the info

        Returns:
            None