I first addressed this issue in tip 5920 » How do I speed up Disk Cleanup or possibly prevent it from hanging?
Another cause of this problem can be that Disk Cleanup starts compressing files in the system cache, and some of these files are being used during the compression.
To prevent this behavior:
1. Copy / Paste the following to a CompressOldFiles.reg file:
2. Merge the CompressOldFiles.reg file with your registry, or run regedit /s CompressOldFiles.reg.