tweaked the ci script and prevented the manage_es fcuntion from returning before it can close the opened groups