Nifty ends higher lifted by gains in Reliance, auto stocks, midcaps