Make the test database removal more robust