Arduino - 'setLocked' was not declared in this scope

It is MUCH easier to see what } goes with what { if you put the { on a line by itself.

The loop() function is NOT closed. Use Tools + Auto Format. If it fails, you KNOW the curly braces are not matched.