fixed closing animation, updated event handling