Crews have stopped the growth of a huge wildfire that has destroyed dozens of homes in a rural area of California near Yosemite National Park.