Fixed rare crash on Keyboard.isKeyDown

Fixes #1090