Nifty ends at record closing high, Sensex rises 872 points; Titan, HDFC surge