Fix memory leak in handledKeydownEvents for repeated keydown events

`handledKeydownEvents` leaks when a keydown event 'repeats' (ie. the user holds the key), since we only remove one of the keydowns corresponding to the current keyup event. This PR instead uses a `filter` call, which removes all the keydown events that relate to the keyup and prevents the leak.
What about something like e98dc123738d0aaf5aae76ee2f8362ef666f8315?