The compiler found the end of a block while in a loop. Check out your blocks and fix them.
This also happens when you use just "end;" instead of "end loop;".