optionally copy stream with output stream left open