Pope Benedict offers thanks before leaving Castelgandolfo