Deal reached to allow stranded Cuban migrants out of Costa Rica