Be sure not to close spans that haven't been opened.