Polls have officially closed in Canada for a tightly contested general election pitting incumbent Prime Minister Justin Trudeau against conservative rival Erin O'Toole.