How can i collapse all the headers in my note?

If you open the command palette, there are the commands “Fold all headings and lists” and “Unfold all headings and lists”. You can assign hotkeys to this if you desire.