Australian PM to leave office after losing party leadership challenge