It's well proven that repeating mistakes is bad, always take a break if this happens.
Changing something about how you are playing helps too, so try the rhythm on a different melody, speed up or down, play the melody to a different rhythm or play in a different position. These halpcement the bits that stay the same.
Also, sleeping on it is good, you may well come back and find it easier because the practice has had a chance to 'fix' in your longer term memory.