I had the same problem. The easy solution is to reset the pc or reset the memory from the GPU (that work for me):

sudo nvidia-smi --gpu-reset

But I don’t know why this happens, only that I have to stops the scripts using ctrl-c.