teardown refactor to handle cases of no containers running