Solved by ptrblck in post #9 
              
              
                Might be. I’ve seen all kind of weird restarts etc. with notebooks. 
So if something doesn’t seem to right, I would recommend to run the script in a terminal, which should work.