Quick patch: Fixing a premature closing of a stream.