Fix issue with accordion headers not correctly maintaining collapsed state.

Previously, groups closed by opening a different group would not update the header
class. This is fixed by adding or removing `collapsed` class from all
togglers with the relevant target on show or hide.
Minor refactor, using lang.hitch to fix scope