fn toggle_close(w: impl Write)