Maintain folder expanded state when last child is deleted

Fixes #6483 

cc @iwehrman @RaymondLim