Added 'if' server socket 'is' connected check to __exit__().

Added 'if' server socket 'is' connected check to __exit__().