I would say you are having a tough luck (sorry). You will get an error when trying the import and then you can try with a different chunksize. But that's a good question indeed ... :)
A modification to the script could be to look for a match at the end of a chunk for any match for any substring of "TABLESPACE " and if that happens, read the following chunk, check that at the beginning you can actually match the whole string you are looking for (concatenating both the previous chunk and this one) and do the replacement there ... :-?