lib: Wrap notmuch_database_add_message in an atomic section.