Shape flows for spectral optimization problems