Hello Georgina,
I've encountered the same phenomenon when coding Python into SPSS syntax. Had a nice discussion about this with SPSS tech support.
Let's presume your code is valid and can operate without bugs.
The BEGIN PROGRAM R\PYTHON. - END PROGRAM. It is different from other blocks of code in SPSS. You must highlight the entire block from BEGIN PROGRAM R\Python to END PROGRAM. And of course, all the code in between, and only then click Run.
If you Run in any other way, you will get the _SLINE OFF error, the processor is busy, and the file is caught in memory. To release it, you need to run any BEGIN PROGRAM R\PYTHON. - END PROGRAM. That is valid (like a print command or such).
It is some sort of defect that they might address in future versions.
I can show you how to do it with a screen capture if you are not sure.