Fix memory leaks in tests. All tests run to completion