Ensure tables are closed only once