close the connection on exit