Fix keyboard instrument mode switching (proper fix, reverts previous commit).

- Switch modes only when all keys on all keyboards are released.
- Write log messages about mode changes to ease debugging.