ensure counter being closed