Implement tdata_close_dynamic to free the mess we made.