PM Scott Morrison gives thanks after miracle win in federal election