Cubs use Peralta's errors to beat Tigers 4-3