How do I delete persistent workers?

For some reason, I can’t train for multiple epochs without cv2 or hd5py getting deadlocked. (freezes immediately at the start of the second epoch)
I found that using persistent workers solves the issue.
But after I’m done training how do I go about deleting the extra processes?

using del trainloader doesn’t end the extra processes