Error in R gbm function when cv.folds > 0

Hi when I run gbm 2.1.5 version with the following code, the R studio crashes with a fatal error. However if I set the value of cv.folds to 0, it works fine.

GradientBosstingModelBAL1 <- gbm(formula = DEPY ~., distribution = "bernoulli", data = balancedData1, n.trees = 1000,
interaction.depth = 4,
shrinkage = 0.01,
cv.folds = 5, verbose = FALSE)

Could you please help me on this issue?
Kind regards.