When adding a link to an element you can change how the other layers/groups would respond depending on if you want to close all other groups that are visible, or simply close the ones that are on the same level as the group you're opening.
These options can be found when you select the Group/Layer link type from the drop-down menu, under Links tab of the Object panel.
The 3 different options will show under the list of layers:
None: No additional action will take place when clicking the link of the element.
Close All Other Groups: This will close every group that is currently open in the publication.
Close Group on the Same Level: This will only close groups/layers that in the same grouped area as the clicked element. Example, (Main Group(Group1)(Group2)(Element with Link)Main Group) This will close Group 1 and 2 when clicking the element with a link.