An out-of-control bushfire has come dangerously close to homes in Perth’s north, with residents told to flee.