Markets closed marginally in the green with the Sensex up 39 points at 21,072 and the Nifty gained 10 points at 6,278 as traders rolled over positions in the futures & options (F&O) segment from the near month December 2013 series to January 2014 series (provisional).