Fixes #1410

As pointed out, `newChild.parent` could be accessed after it was set to
undefined. This fix unifies the code from the various `destroy` methods so
the previou issue does not occur.
Merge pull request #1417 from pnstickne/wip-1410

Fixes #1410 where newChild.parent could be set to undefined before use