bug fix: sockets not being closed on exit