check-code: add check for lock release order