Generalize the cleanup process, and add signal for unprocessed TeX in text mode