close tags and clean up