DeveloperError

I’m getting an error that says : uncaught exception: DeveloperError: This object was destroyed, i.e., destroy() was called.
@http://localhost:8080/Source/Core/DeveloperError.js:44.

In my code I am adding/deleting point billboards and adding/deleting czml files. I can add points and czml files. The error happens when I delete point billboard points and the try to re-add czml files. The code for my delete billboard points looks like:

function cleanup() {
widget.scene.getPrimitives().removeAll();
}

new Button({
label : ‘Delete point billboards’,
onClick : function() {
cleanup();
Sandcastle.highlight(addPointBillboards);
}
}).placeAt(‘toolbar’)

I think the problem is with the getPrimitives.removeAll in the cleanup() function but I don’t know how to fix it. Any advice? Thanks