Fixed crash if no window has keyboard focus