Tidy up log messages and avoid unnecessary processing.
Handle mailbox being set to null when opening folder.