Flag imap session for closing. Fixes: #4925

This will need a more serious investigation, since we're not shutting
down all the imap-related objects, but will do for now to prevent
access to different accounts while a session is initiated in the MUA.
(tested with thunderbird).