Sensex and Nifty closed in the green on Wednesday with marginal gains. The benchmark index Sensex posted gains of 0.14 per cent to close at 66,023.24 while Nifty closed above 19,811.85. Both the indices had a rollercoaster day, swinging from losses to gains at the time of closing.