Fix Tests resource leaks.