add exception to logging connection failure, do not close a null stream handle.