Sorry I had forgotten this tutorial was based on the browser. Working in the browser is primarily for learning, this really needs to run as a server-side process. I'm not sure it's viable to have it restart effectively in the browser.
I can add a step-by-step 'always on' tutorial to the list but I have a very long list. I have many projects to work on so I won't be able to work on this for you in any short amount of time, sorry.
No problem, thank you for your time, I found a small solution for now, refresh the page when the script gets an error, I'll start learning javascript, it should not be that hard since I've worked a little with C#, C, C++. Thank you for your tutorials I'll stat from there.