This fixes reported issue, but there could be more of those hidden in Freestyle code, it did not handle user refcount at all (and the fact it by-passes BKE in some places for efficiency does not help here). Note that this should be relatively harmless, since freestyle uses own Main during render, so everything is cleaned up in the end in any case... But better try to handle IDs correctly here too. :)