Further tweaks to IMAP locking.

See #16.