The levels aren't infinite there's a portal near the start of each level telling you how many enemies you need to kill, after that you can return to the portal. It's not very clear in the game.