Here's a tip for people struggling: as long as the tip of your mouse doesn't touch the border of the maze you won't have to restart. At first I thought it was the whole cursor that had to stay away from the borders, but after I figured that out it was a breeze.
Also btw amazing game!