Your script has timed out try raising the max_execution_time it defaults to 30 seconds I think, or do them in batches.