fix possible double free in TextIOWrapper.__init__ (closes #22849)

--HG--
branch : 3.4