Fix LockContext to use device_handler

LockContext was not using the new device_handler feature, making it
impossible to use the "with m.locked('candidate')" statement.