How to RunScript in Headless Doc - Python

Hi, I’m trying to use RunScript in a headless doc.
I can’t figure out why this doesn’t work
I get this error Unknown Command: /Users/johanpedersen/Desktop/test.3dm

doc = RhinoDoc.CreateHeadless(None)
serial = doc.RuntimeSerialNumber
s = RhinoApp.RunScript(serial, "-saveAs /Users/johanpedersen/Desktop/test.3dm", False)
doc.Dispose()

The example above works if the doc is not headless.

Can anyone help me out?