The solution I suggest you is to open the terminal and paste
jupyter notebook stop
and it will stop running the code.