close session before tearing down test db

Solves a test hang problem.
make clear-db support -c

Need it to debug weirdness with the test code's database teardown.