Configuration.lock_file: Avoid trying to unlock locks in the module where locking failed. Also made the unlocking of previous locks more explicit for readability. Fixes an assertion failure in module.unregister_lock.