diff --git a/src/sbbs3/ctrl/MainFormUnit.cpp b/src/sbbs3/ctrl/MainFormUnit.cpp
index 92405b82d0903f30dd55e814977b7719efedcf8f..3ed714e23d85525dd1121e3338998b86d4094dbe 100644
--- a/src/sbbs3/ctrl/MainFormUnit.cpp
+++ b/src/sbbs3/ctrl/MainFormUnit.cpp
@@ -828,7 +828,10 @@ void __fastcall TMainForm::FormCloseQuery(TObject *Sender, bool &CanClose)
         FtpStopExecute(Sender);
     }
 
+    time_t start=time(NULL);
 	while(TelnetStop->Enabled || MailStop->Enabled || FtpStop->Enabled) {
+        if(time(NULL)-start>15)
+            break;
         Application->ProcessMessages();
         Sleep(1);
     }