Energy and tech stocks help lift TSX while U.S. stock markets rally before holiday