IO.copy_stream should handle objects that respond to read or write. Fixes #437