Use the correct errno and remove cleanupRunningProcess