Pope Francis will close his visit to Chile on Thursday with an open-air mass on the beach, before leaving for Peru on the last leg of his South American trip.