Don't close an already closed socket.
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index ffe6b44..cb802e8 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -610,9 +610,11 @@
 {
 	if (!PyArg_NoArgs(args))
 		return NULL;
-	Py_BEGIN_ALLOW_THREADS
-	(void) close(s->sock_fd);
-	Py_END_ALLOW_THREADS
+	if (s->sock_fd != -1) {
+		Py_BEGIN_ALLOW_THREADS
+		(void) close(s->sock_fd);
+		Py_END_ALLOW_THREADS
+	}
 	s->sock_fd = -1;
 	Py_INCREF(Py_None);
 	return Py_None;