Fix teardown in ha agent tests