auto-close tables
add disconnect function to db