pub(crate) fn finalize_shm(shm: &mut SharedMemory) -> Result<()>