v0.2: fixing issue of double close()'s to underlying stream