Moves the removal of children to an internal function.

This prevents the ambiguity of the call stack when a user wanting to clear a collection as opposed to a collection being cleared prior to closing.

fixes #1604
function() {

plz

ping @thejameskyle why did jshint not catch this?