Fixes database teardown in tests.