If you're on Mac, hold down Command while clicking the disclosure triangle to open or close everything.
The state of the folders should be remembered for the duration of your session, but if the file is hosted, the state when you close is not saved. If you want to change the state on a hosted file, you have to take it down from the server and open it in FileMaker Pro locally, make your changes, then host it again. Same for Global field values and a variety of other settings that usually only affect the developer (layout mode settings, etc.).
On Windows, ctrl+click did it.
It looks open/close state of folder is saved in somewhere client PC since it is kept after exiting application on Windows, but I found only which script is opened in editor tab (and some options for it?) in registry.