Can you fix the problem in the code that is responding to the `'hidden'` event?  The event itself seems appropriate, although, if I'm reading the bootstrap code correctly it doesn't always wait for the animation to complete.