Fixed crashes caused by updating running state after IMAP connection is released