BB10: Clean up IMF session code

Be more rigorous about checking if we're in a session before invoking IMF functions.  In
particular the code would call initEvent if a key was received while no text field had focus
leading to a crash.

Also closeSession is now always called when a session is terminated rather than just
setting sInputSession to 0 and hasSession is always called to check for a valid session.

Change-Id: I22ce1c9bcdf8dd130f05ae319c4cc1e01afc4456
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Reviewed-by: Bernd Weimer <bweimer@blackberry.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>