text: Title: Edge case: callable alias with full capturing and redirect in the middle: `I/O operation on closed file`
  Body: Two ways for reproduce:
  ```xsh
  $XONSH_SHOW_TRACEBACK = True
  @aliases.register
  def _e():
      echo -n O
      echo -n E 1>2
      execx("echo -n O")
      execx("echo -n E 1>2")
      print("o")
      print("O", file=o)
      print("E", file=e)
  
  for i in range(5):
      p = !(e > /tmp/ttt)
      $[e > /tmp/ttt2]
      p.end()
      print(p)
  ```
  ```xsh
  $XONSH_SHOW_TRACEBACK = True
  @aliases.register
  def _e():
      echo -n O
      echo -n E 1>2
      execx("echo -n O")
      execx("echo -n E 1>2")
      print("o")
      print("O", file=o)
      print("E", file=e)
  
  for i in range(5):
      print(!(e > /tmp/ttt), $[e > /tmp/ttt2])
  ```
  Exception:
  ```xsh
  Exonsh: To log full traceback to a file set: $XONSH_TRACEBACK_LOGFILE = <filename>
  Traceback (most recent call last):
    File "<stdin>", line 7, in <module>
    File "/Users/pc/git/xonsh/xonsh/procs/pipelines.py", line 217, in __str__
      self.end()
    File "/Users/pc/git/xonsh/xonsh/procs/pipelines.py", line 478, in end
      self._end(tee_output=tee_output)
    File "/Users/pc/git/xonsh/xonsh/procs/pipelines.py", line 486, in _end
      for _ in self.tee_stdout():
    File "/Users/pc/git/xonsh/xonsh/procs/pipelines.py", line 388, in tee_stdout
      for line in self.iterraw():
    File "/Users/pc/git/xonsh/xonsh/procs/pipelines.py", line 260, in iterraw
      stdout = NonBlockingFDReader(stdout.fileno(), timeout=timeout)
                                   ^^^^^^^^^^^^^^^
  ValueError: I/O operation on closed file
  
  ```
  
  (Found in https://github.com/xonsh/xonsh/issues/5631#issuecomment-2266321712)
  
  ## For community
  ⬇️  **Please click the 👍 reaction instead of leaving a `+1` or 👍  comment**
  