Tidal disruption flares as the source of ultra-high energy cosmic rays