Wait until after the LSM tree state is updated (including getting an exclusive lock) before changing the btree status to read-only and evictable.  This is an attempt to avoid a race between flushing all chunks and compaction.