Added function for closeing the connection.

However still issues with "Address already in use"