[Optimization] Global state variable is used to determine whether preprocessor is run or not. To reduce number of calls to close.