only close writer when we are done