Simplify afterRender and fix bug where closing a switcher would throw