code: def test_sink_to_textfile_closes():
      source = Stream()
      with tmpfile() as filename:
          sink = source.sink_to_textfile(filename)
          fp = sink._fp
          _global_sinks.remove(sink)
          del sink
  
          with pytest.raises(
              ValueError, match=r"I/O operation on closed file\."
          ):
              fp.write(".")
  
file_path: streamz/streamz/tests/test_sinks.py
imports: import weakref
  import pytest
  from streamz import Stream
  from streamz.sinks import _global_sinks, Sink
  from streamz.utils_test import tmpfile, wait_for
label_desc: Use image node_id 4 for calling a global function with example usage: test_sink_to_textfile_closes() without return types