AutostartManager: do not store pid if it is null.

This resolves the segmentation faults when LaunchMode is SYNC.