Nifty ends at record high