Warriors beat Cavaliers to NBA title