diff --git a/CMakeSettings.json b/CMakeSettings.json
new file mode 100644
index 0000000000000000000000000000000000000000..e8c1f1df950f887a11e083a749d5d0c56a689f3d
--- /dev/null
+++ b/CMakeSettings.json
@@ -0,0 +1,37 @@
+{
+    // See https://go.microsoft.com//fwlink//?linkid=834763 for more information about this file.
+    "configurations": [
+        {
+        "name": "x86-Debug",
+        "generator": "Visual Studio 15 2017",
+        "configurationType" : "Debug",
+        "buildRoot":  "${env.LOCALAPPDATA}\\CMakeBuild\\${workspaceHash}\\build\\${name}",
+        "cmakeCommandArgs":  "",
+        "buildCommandArgs": "-m -v:minimal"
+        },
+        {
+        "name": "x86-Release",
+        "generator": "Visual Studio 15 2017",
+        "configurationType" : "Release",
+        "buildRoot":  "${env.LOCALAPPDATA}\\CMakeBuild\\${workspaceHash}\\build\\${name}",
+        "cmakeCommandArgs":  "",
+        "buildCommandArgs": "-m -v:minimal"
+        },
+        {
+        "name": "x64-Debug",
+        "generator": "Visual Studio 15 2017 Win64",
+        "configurationType" : "Debug",
+        "buildRoot":  "${env.LOCALAPPDATA}\\CMakeBuild\\${workspaceHash}\\build\\${name}",
+        "cmakeCommandArgs":  "",
+        "buildCommandArgs": "-m -v:minimal"
+        },
+        {
+        "name": "x64-Release",
+        "generator": "Visual Studio 15 2017 Win64",
+        "configurationType" : "Release",
+        "buildRoot":  "${env.LOCALAPPDATA}\\CMakeBuild\\${workspaceHash}\\build\\${name}",
+        "cmakeCommandArgs":  "",
+        "buildCommandArgs": "-m -v:minimal"
+        }
+    ]
+}
\ No newline at end of file
diff --git a/picoquic/frames.c b/picoquic/frames.c
index 96c3a9571125a42fa15605b2d9c289fb91f63e7d..214324144cefd7e015b53f1b0d43832044678c22 100644
--- a/picoquic/frames.c
+++ b/picoquic/frames.c
@@ -2463,7 +2463,7 @@ int picoquic_decode_connection_close_frame(picoquic_cnx_t * cnx, uint8_t * bytes
 
     if (ret == 0)
     {
-        cnx->cnx_state = picoquic_state_disconnected;
+        cnx->cnx_state = picoquic_state_closing_received;
         cnx->remote_error = error_code;
         *consumed = (size_t)(string_length + byte_index);
         if (cnx->callback_fn)
@@ -2610,7 +2610,7 @@ int picoquic_decode_application_close_frame(picoquic_cnx_t * cnx, uint8_t * byte
 
     if (ret == 0)
     {
-        cnx->cnx_state = picoquic_state_disconnected;
+        cnx->cnx_state = picoquic_state_closing_received;
         cnx->remote_application_error = error_code;
         *consumed = (size_t)(string_length + byte_index);
         if (cnx->callback_fn)
diff --git a/picoquic/sender.c b/picoquic/sender.c
index d5e4c4d66558c92d505f9434b72f290102a373d4..b5f65cb258e2ffa1f5ba8b6af87f0112c2424704 100644
--- a/picoquic/sender.c
+++ b/picoquic/sender.c
@@ -774,16 +774,9 @@ int picoquic_prepare_packet(picoquic_cnx_t * cnx, picoquic_packet * packet,
         packet->send_time = current_time;
 
         /* Send the disconnect frame */
-        if (cnx->local_error == 0)
-        {
-            ret = picoquic_prepare_application_close_frame(cnx, bytes + length,
+        ret = picoquic_prepare_connection_close_frame(cnx, bytes + length,
                 cnx->send_mtu - checksum_overhead - length, &consumed);
-        }
-        else
-        {
-            ret = picoquic_prepare_connection_close_frame(cnx, bytes + length,
-                cnx->send_mtu - checksum_overhead - length, &consumed);
-        }
+
         if (ret == 0)
         {
             length += consumed;