diff --git a/lib/service.c b/lib/service.c
index a17496e71f4c3ad62f8d783da391f72477598e7f..1571a198fbf91886e46306a12fea0ed7aa0c8735 100644
--- a/lib/service.c
+++ b/lib/service.c
@@ -117,6 +117,11 @@ lws_handle_POLLOUT_event(struct libwebsocket_context *context,
 		return 0;
 	}
 
+	/* if we are closing, don't confuse the user with writeable cb */
+
+	if (wsi->state == WSI_STATE_RETURNED_CLOSE_ALREADY)
+		goto user_service;
+	
 	/* if nothing critical, user can get the callback */
 	
 	m = lws_ext_callback_for_each_active(wsi, LWS_EXT_CALLBACK_IS_WRITEABLE,
@@ -205,9 +210,8 @@ lws_handle_POLLOUT_event(struct libwebsocket_context *context,
 	}
 #ifndef LWS_NO_EXTENSIONS
 	wsi->extension_data_pending = 0;
-
-user_service:
 #endif
+user_service:
 	/* one shot */
 
 	if (pollfd) {