Why does this not work for me (Caché 2016.2.2)?

ClassMethod WriteObjectToFile(pObject As %DynamicObject)
{
SET filename="/ps/pctran/Temp/ETIM.json"
SET stream = ##class(%Stream.TmpCharacter).%New()
SET filestream = ##class(%Stream.FileCharacter).%New()
SET sc = filestream.LinkToFile(filestream)
do pObject.%ToJSON(stream)

DO filestream.CopyFrom(stream)
DO filestream.%Save()
}

I get an <STORE> error

What ist the problem?