just close the connection if the connection is already connected