common/tags: dynamic_cast for type testing, not static_cast
mkvmerge: delete old statistics tags when appending

See #1021.