Basic code to close connection when done