Add cleanup on connection failure