fix the generated html and add a closing div tag