Change `transitionend` event listener to `setTimeout`

More reliable and seems to work better when windows loses focus.