close instances in before after test. Attempt to fix #3673