fix shutdown of connection, only shutdown open connections