There’s no option for this that I’m aware of but the state of my folders, collapsed or not, is the same when I close and re-open my vault. Perhaps a plugin is expanding everything? Have a look at the troubleshooting steps.
This button here is a quick way to collapse everything →