Ensure close cleanup occurs no matter what state the connection was in.