A mass stranding of long-finned pilot whales in Western Australia led to the deaths of 29 of the creatures that beached near a tourist town.