Clean up unused ad-hoc elements before saving

This refers to a node and edge created when re-rooting a Nexson tree on
an edge. If these are added, then we re-root to an existing node, we can
remove the ad-hoc elements to avoid clutter.