Fix crash opening/closing physical  keyboard