fixed exception during closing of fully read stream