Stop listening to the keyboard when not the top view controller.

Fixes #980 
Only listen for keyboard events when the view is visible.