An out-of-control bushfire has come close to wiping out a caravan park north of Perth.