Converting Lines to Polygons in QGIS produces Sliver Polygons
Got the exact polygons as desired using the 'Polygonize' algorithm (Processing Toolbox --> QGIS Geoalgorithms --> Polygonize) in the python console.
import processing
polygon_path = "C:\\Documents and Settings\\User\\polygonsFormed.shp"
line_path = "C:\\Documents and Settings\\User\\inputLine.shp"
processing.runandload("qgis:polygonize",line_path,False,False,polygon_path)