Easier would be to just put the unlock above the `if !ok {`.