[backend] Fix locking in the compiler.