Fixed minor writer close stream bug.