Resonant interaction between runaway electrons and the toroidal magnetic field ripple in TCV