On the same machine I created client and server application where client always starts communication and open socket to server on port 2001.
Netstat shows:

1) tcp 0 0 0.0.0.0:2001 0.0.0.0:* LISTEN 86198/server
2) tcp 0 0 127.0.0.1:2001 127.0.0.1:45664 ESTABLISHED 86198/server
3) tcp 0 0 127.0.0.1:45664 127.0.0.1:2001 ESTABLISHED 86199/td

First entry is the listener and the others client to server connection and server to client communication.

the stranger thing is that:

if I close both sockets (both on client and on server) connection n.2 (which I shown above by netstat ) always is kept in TIME_WAIT state and after specific time seconds goes to timeout.
I would be expected to see any connections!

I tried to close only socket on client side or only on server side but result is always the same, this entry is over there !
tcp 0 0 127.0.0.1:2001 127.0.0.1:45664 ESTABLISHED 86198/server

what happened ?