ButtonGroup: reordered adding of event handlers so that Alert closing won't throw an error caused by disposed ButtonGroup (closes #797)