Clean up properly when table is removed from DOM.