[IMP] im_chat: ESC shortcut to close chat window

Cherry-picked from 0172cfba76ae4509be33220f6d4ef09c005c8312
Closes #2335