Fun little loop! I had a bit of trouble understanding the game's win condition, since nothing happened after getting all the crabs and killing all the ghosts.
After killing the ghosts you are to eat them to win. The ghosts collection is a hidden condition required for clearing the game.