Add logic to avoid reconnetion when finalize