diff --git a/scheduler/client.c b/scheduler/client.c
index cc95af31e2955e86d7bcc2a2ff1b3dc14b0a6d3f..c5379aa384c7ed63d6d4fff0190fe2910ac9a0fb 100644
--- a/scheduler/client.c
+++ b/scheduler/client.c
@@ -680,6 +680,7 @@ void CLIENT_InitThread(void)
     wine_server_send_fd( reply_pipe[1] );
     wine_server_send_fd( teb->wait_fd[1] );
     teb->reply_fd = reply_pipe[0];
+    close( reply_pipe[1] );
 
     /* set close on exec flag */
     fcntl( teb->reply_fd, F_SETFD, 1 );
@@ -699,7 +700,6 @@ void CLIENT_InitThread(void)
         version  = reply->version;
         if (reply->boot) boot_thread_id = teb->tid;
         else if (boot_thread_id == teb->tid) boot_thread_id = 0;
-        close( reply_pipe[1] );
     }
     SERVER_END_REQ;
 
diff --git a/server/request.c b/server/request.c
index 855e877560828975520d4111871128b69cf110dd..36257c680bf9b8cde41a546f2dc091bdb5265327 100644
--- a/server/request.c
+++ b/server/request.c
@@ -341,7 +341,7 @@ int receive_fd( struct process *process )
         if (data.tid) thread = get_thread_from_id( data.tid );
         else thread = (struct thread *)grab_object( process->thread_list );
 
-        if (!thread || thread->process != process)
+        if (!thread || thread->process != process || thread->state == TERMINATED)
         {
             if (debug_level)
                 fprintf( stderr, "%08x: *fd* %d <- %d bad thread id\n",