Don't wrap elements twice when followed by closing tags

Fixed #9