close connection at exit