Prevent re-entrancy while switching keyboards (LT-15288)

This prevents a crash when the Keyman TSF Addin is enabled and the user has assigned a TSF Addin layout to a writing system. Fixes LT-15288.