properly remove classes on modal close