Fixed header
Now able to close sockets safely.
stop thread added