[SPARK-3736] Cancel attempts to reconnect if the master changes.