Generate implied end tags correctly

Based on the list actually specified in http://www.w3.org/html/wg/drafts/html/master/single-page.html#generate-implied-end-tags