removes unnecessary closing divs