ensures open/close of GBfile while parsing