Fix infinite loop on bad post content tags

Fixed an infinite loop if a tag in a post isn't correctly closed.