Merge pull request #459 from Maaack/fix-pause-close-event-order