Client now knows when the server has closed down. However, it only knows after it has sent 3 messages to the server. I'll need to find some way to get a more immediate notification.

Minor variable declaration changes, mostly removing explicit declarations