maildir_store_get_folder_sync: Fix a use-after-free issue