dark magic to ensure connections are closed