Particle and script editor crash fixes.

I think there is still a lot wrong with the particles. Sometimes the program hangs when particle scripts are running, though that may be coincidence.