close connection in finally block