add code to ensure Sockets get closed

also, namespace in pom warning fixed.