let timer = setTimeout(shakeTimer, 3000);
Passing in a setInterval variable, you can tell it to stop.