I was finally able to finish the level. I've been playing some more, and it happened again on level 19. I think it has something to do with my USB mouse and my trackpad being active at the same time. I normally have my settings so that if I have the USB mouse plugged in the trackpad will become inactive. Its only when I've let both work at the same time that I get this bug. I've had problems with my trackpad before; for example, occasionally when I have it on and I'm browsing the web, my browser will randomly go back a page. Maybe this is a similar thing, though I have no idea why it would happen.