Closing connection function added.