bpo-22831: Use "with" to avoid possible fd leaks in tools (part 2). (GH-10927)

diff --git a/Tools/demo/rpython.py b/Tools/demo/rpython.py
index 5e7bc0a..8d7e274 100755
--- a/Tools/demo/rpython.py
+++ b/Tools/demo/rpython.py
@@ -22,17 +22,16 @@
         port = int(port[i+1:])
         host = host[:i]
     command = ' '.join(sys.argv[2:])
-    s = socket(AF_INET, SOCK_STREAM)
-    s.connect((host, port))
-    s.send(command.encode())
-    s.shutdown(SHUT_WR)
-    reply = b''
-    while True:
-        data = s.recv(BUFSIZE)
-        if not data:
-            break
-        reply += data
-    print(reply.decode(), end=' ')
-    s.close()
+    with socket(AF_INET, SOCK_STREAM) as s:
+        s.connect((host, port))
+        s.send(command.encode())
+        s.shutdown(SHUT_WR)
+        reply = b''
+        while True:
+            data = s.recv(BUFSIZE)
+            if not data:
+                break
+            reply += data
+        print(reply.decode(), end=' ')
 
 main()