1.
"CanClose" is True by default in the OnCloseQuery event. You need to change it to False if the App can not be closed.
2. Before disconnecting the Client, set AutoConnect:=False on the Client component.
3. After disconnecting the Client, set Server:=nil on the Client component.
Let me know if that helped.
P.S. When you directly attach a MessageServer to a MessageClient using its Server property, the Server component is basically a "transport" for the Client. In that scenario, the Client is directly executing methods on the Server and the Server is directly calling methods on the Client when they communicate. In fact, the two components act as one in that case. Destroying one of the components without removing a link to the other component is a guarantee for trouble.
Best Regards,
Danijel Tkalcec