Automatically delete metadatafactory when its parent gets deleted.

There are various leaks in libmythmetadata. This changes only fixes one of them. Ref #11754

Fixes #11751