properly close database on teardown