If stream is not a file-like object, should throw exception, not silently fail