*TSX ends with small gain as energy shares strengthen
*U.S. looks near final deal on bailout proposal
*Shares of gold producers fall along with bullion price (Updates closing numbers, adds details, quotes)
TORONTO, Sept 25 (Reuters) - The Toronto Stock Exchange's main index logged a small gain on Thursday as oils strengthened and financials rose as the U.S. Congress appeared close to an agreement on a financial industry bailout plan, but gains were dampened by weak gold producers.
Financial shares rose 1.5 percent as a deal on the $700 billion U.S. plan looked close. For more details, see [ID:nSP335584]. In the group, Canadian Imperial Bank of Commerce (CM.TO) was up 2.7 percent at C$64.00.
The heavyweight energy sector buoyed the market, taking a cue from oil prices, which also rose on optimism over the U.S. bailout. Canadian Natural Resources (CNQ.TO) was up 2.4 percent at C$84.15, while the group rose 1.5 percent.
"We're still going through the obligatory political posturing by the various politicians there until they finally decide that they're going to write this thing into law," said Lex Kerkovius, senior research analyst at McLean & Partners Wealth Management Ltd., in Calgary, Alberta.
"The general undertone right now ... is that this has got to be done because if you don't do it, we're dead," he added.
After another choppy session, the S&P/TSX composite index .GSPTSE closed up 33.15 points, or 0.26 percent, at 12,546.51 with seven of its 10 main sectors pushing higher.
On the downside, the gold subindex lost 4.5 percent, pressuring the larger materials sector as the price of bullion fell. Goldcorp (G.TO) dropped 6.2 percent to C$35.60, while Barrick Gold (ABX.TO) slid 5.6 percent to C$37.70. The materials group as a whole fell 3.6 percent.
In the tech area, MacDonald, Dettwiler and Associates (MDA.TO) tumbled after the company warned on Wednesday that a downturn in the British housing market will hurt its third-quarter profit. MDA was down 16.2 percent at C$23.00. See: [nN25507419].
In results released after the bell, BlackBerry maker Research In Motion RIM.TO reported a sharply higher quarterly profit but its forecast for the next quarter disappointed investors, sending its shares down more than 15 percent in after-hours trading in New York. ($1=$1.03 Canadian) (Reporting by Leah Schnurr; Editing by Peter Galloway)