Your cmdlet must not retain any handle to an object passed to WriteObject. That object is handed to the next cmdlet in the pipeline, or it is used by a script.
If you keep a handle, two entities own the object. Shared ownership of a pipeline object causes errors.