Fix setting exit_on_escape atribute on on_keyboard method

Fixes issue #1967