insert state check for closed CSV writer