Fix bad qemud crash on emulator startup.
diff --git a/emulator/qemud/qemud.c b/emulator/qemud/qemud.c
index 5edf8a6..92b2a2b 100644
--- a/emulator/qemud/qemud.c
+++ b/emulator/qemud/qemud.c
@@ -849,6 +849,10 @@
 static void
 fdhandler_shutdown( FDHandler*  f )
 {
+    /* prevent later fdhandler_close() to
+     * call the receiver's close.
+     */
+    f->receiver->close = NULL;
 
     if (f->out_first != NULL && !f->closing)
     {
@@ -856,11 +860,6 @@
         f->closing = 1;
         fdhandler_remove(f);
         fdhandler_prepend(f, &f->list->closing);
-
-        /* prevent later fdhandler_close() to
-         * call the receiver's close.
-         */
-        f->receiver->close = NULL;
         return;
     }