For starters, there is a Competing Risks Survival Regression extension available from the Extension Hub. It is implemented in R, but you would run it like normal SPSS syntax via Analyze > Survival > Competing Risks Regression. You don't write any R code in that case.
The error messages you are getting for your R code suggest that something is not closed in your program. Restarting SPSS is one way to resolve that. Beyond that, you would need to post your R code for a diagnosis.
Typically you would use the GetDataFromSPSS to load the variables and then have a library call for cmprsk followed by invoking that.function.