Harvick takes advantage of Hamlin's crash to win Brickyard