GH-94644: fix test_curses ref leak (GH-94647)

(cherry picked from commit 277f55cb04409ccdf651d43df5eb9dcb3ee3128c)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
1 file changed