Energy and tech stocks help lift S&P/TSX composite, U.S. stock markets also higher