MaterializationUnits may contain arbitrary resources that need cleanup. We want to do this outside the JIT's session lock. This should fix a lock-order-inversion warning in clang-repl (for details see https://github.com/llvm/llvm-project/issues/124215).