Why can't I print the glossary in other part that the end of document

I tried to look for similar question, but none of them seems to have the same issue. I'm using the glossaries package and I followed the tutorials on how to use it (see code). The only different thing is that I want to print the glossary after the table of contents page and not a the very end of the document.

% header.tex
\documentclass[a4paper,11pt,twoside,english]{book}
\usepackage[a4paper,left=3.5cm,right=2.5cm,bottom=3.5cm,top=3cm]{geometry}

\usepackage[english]{babel}

\usepackage[pdftex]{graphicx,color}
\usepackage{amsmath,amssymb,subfigure}

% Abkuerzungsverzeichnis
\usepackage[nonumberlist,toc]{glossaries}
\makeglossaries{}
\newglossaryentry{DSL}{name={DSL},description={Domain-Specific Language}}
\newglossaryentry{Bbb}{name={BBB},description={Second abbreviation}}
\newglossaryentry{Ccc}{name={CCC},description={Third abbreviation}}

% Theorem-Umgebungen
\usepackage[amsmath,thmmarks]{ntheorem}

% Korrekte Darstellung der Umlaute
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}


% main.tex
\begin{document}

\input{kapitel/frontpage}
\blankpage{}
\pagenumbering{roman}
\tableofcontents
\cleardoublepage{}
% Glossary
\printglossary[title=Special Terms, toctitle=List of terms]
\clearpage
\pagenumbering{arabic}
% Chapters
\setlength{\parskip}{1em plus0.1em minus0.1em}
\input{kapitel/introduction}
\input{kapitel/chapter2}
\input{kapitel/chapter3}
\input{kapitel/chapter4}
\input{kapitel/evaluation}
\input{kapitel/futurework}
\input{kapitel/relatedwork}
\input{kapitel/conclusion}

% Appendix
\appendix
\input{kapitel/appendix}
\clearpage
% list of figures
\listoffigures
\cleardoublepage{}
% list of algorithms
\listofalgorithms{}
\cleardoublepage{}
% Literaturverzeichnis
\bibliographystyle{gerplain}
\bibliography{literatur/diplom}
% Erklaerung
\markboth{}{DECLARATION}

the glossary won't show up unless it is placed right before \end{document}, can I fix it, so that it'll show up? Thanks for any help!
• Here is a more minimal code that still produces the issue: \documentclass{book} \usepackage{glossaries} \makeglossaries \newglossaryentry{DSL}{name={DSL},description={Domain-Specific Language}} \begin{document} \printglossary \gls{DSL} \appendix \cleardoublepage \end{document}. Jul 3, 2021 at 8:19
The solution that worked for me was to change \include{header} to \input{header} as suggested here. After that minimal change I ran pdflatex main.tex, which finally added the line \@istfilename{main.ist} into my main.aux file. This line was missing previously and the cmd makeglossaries main was giving me an error with the message No \@istfilename found in 'main.aux'. Then I ran latter cmd again.. et voilà!