       (`headline
        (cond ((org-element-property :todo-type context)
               (org-todo
-               (if (eq (org-element-property :todo-type context) 'done) 'todo 'done)))
+               (if (eq (org-element-property :todo-type context) 'done)
+                   (or (car (+org-get-todo-keywords-for (org-element-property :todo-keyword context)))
+                       'todo)
+                 'done)))
              ((string= "ARCHIVE" (car-safe (org-get-tags)))
               (org-force-cycle-archived))
              (t

        (insert-file-contents-literally file nil 0 bound)
        (+org--get-property name))
    (+org--get-property name bound)))


;;

                  (insert "\n")
                  (if (= level 1) (insert "\n")))))
             (when-let* ((todo-keyword (org-element-property :todo-keyword context)))
               (org-todo (or (car (+org-get-todo-keywords-for todo-keyword))
                             'todo)))))

          (t (user-error "Not a valid list, heading or table")))
