Yes.
I moved the guard up to the main function entry point.
	
	
	
	
I moved the guard up to the main function entry point.
Code:
close_all_folders(#st{pst=Pst0}=St,OpenOrClosed0) 
    when OpenOrClosed0 == open orelse OpenOrClosed0 == closed -> 
    {Key0,Fld}  = gb_trees:get(?FOLDERS,Pst0),
    MyAcc = fun
        (?NO_FLD, MORE, Acc) -> 
            orddict:store(?NO_FLD,MORE, Acc);
        (Key, {open,MORE}, Acc) ->
            orddict:store(Key,{OpenOrClosed0,MORE},Acc);
        (Key, {closed,MORE}, Acc) ->
            orddict:store(Key,{OpenOrClosed0,MORE},Acc)
    end,
    Fld2 = orddict:fold(MyAcc,Fld,Fld),
    Pst1 = gb_trees:enter(?FOLDERS, {Key0,Fld2}, Pst0),
    St#st{pst=Pst1}. 
	 
