Auto close db connection when exception raised in db