Don't run close if stream is nil.