Erlang: Close socket to remove "EADDRNOTAVAIL" error

@gnarg, I did a little change if that's ok.  Basically, I was getting these errors because the sockets weren't closing.  However, this does take a huge performance hit when these sockets are closed.  Any thoughts on how to improve this?

btw, thanks again for all your advice and help.  I definitely learn a lot from this exercise!