I encountered this regularly at one point when both my RAM and hard drive were almost full. I could stop it from happening by closing my browser whenever running these long scripts, and I think it stopped completely once I deleted some big files. But of course, could be just a coincidence.