Remove unneeded end tags.