Introduce a memory shutdown lock.

This allows the debugger to access memory in a safe way that should never
crash.