I am working a lot with 3rd person PSDs in GIMP. They usually contain a lot of layers and by default they are all unfolded in layer tree window. How could I collapse all layers so I will only see top-level ones? Because I am repeadelly closing 40 layers and there is no "collapse all" options.
I presume you are talking about layer-groups, and that you want to collapse all groups (and any sub-groups) so that only top-level layers and layer-groups are shown in the Layers Dialog.
Unfortunately, there is no way to collapse-all groups at the moment - the UI does not provide such a function and it cannot be implemented from a script/plug-in either.
You could report this as a bug or enhancement request - see http://docs.gimp.org/en/gimp-introduction-bugs.html