Correctly release resources after test