Error: System.IO.IOException in Lightmass accessed by another Process (FIX)

Ive had a problem with Swarm Agent throwing a IO error, saying that a material (Mtrlgz) is used by another process.

No solutions found on answerhub that worked.
Finally i found this solution for me:

  1. Duplicate Level
  2. Build (Is gonna fail)
  3. Remove EVERYTHING in the world outliner.
  4. Build and Cancel before it finishes (you must let it export all light data)
  5. Doubleclick that same level (the duplicated) in the contentbrowser to open it, when promted do NOT save! (you do not want to save your removal of everything in the level)
  6. you have have your duplicated level with everything working! Click build and Tadaa! light is building.