Use closing to close generator on termination