Start-Job Ids Incrementing Very Quickly, Why?

Hi all,
I am new to Powershell, this Powershell forum and everything Powershell. To get straight to the point, here’s my script:

$logFile = 'C:\Temp\Active_Connections.csv'
if (-not(Test-Path $logFile -PathType Leaf)){
    New-Item -ItemType File -Force -Path $logFile | Out-Null
    } else {
    Clear-Content $logFile
}
$headersAdded = $true
$newConnections = @()
While ($true){
    $connections = @(Get-NetTCPConnection)
    foreach ($connection in $connections){
        if ($connection.State -eq "Established"){
            if ($newConnections.InstanceID -notcontains $connection.InstanceID){
                if ($newConnections.RemoteAddress -notcontains $connection.RemoteAddress){
                    if ((Get-Job).Name -notcontains $connection.RemoteAddress){
                        Start-Job -Name $connection.RemoteAddress -ScriptBlock {Resolve-DnsName -Name $using:connection.RemoteAddress} >$null
                    }else{
                        $job = Get-Job | Where-Object {$_.Name -eq $connection.RemoteAddress}
                        if ($job.State -eq "Completed"){
                            Add-Member -InputObject $connection -MemberType NoteProperty -Name "Id" -Value $job.Id -Force
                            Try {
                                $receivedJob = $job | Receive-Job -ErrorAction Stop
                                Add-Member -InputObject $connection -MemberType NoteProperty -Name "NameHost" -Value $receivedJob.NameHost -Force
                            }catch{
                                $na = "N/A"
                                Add-Member -InputObject $connection -MemberType NoteProperty -Name "NameHost" -Value $na -Force
                            }
                            #Remove-Job -Id $job.Id
                        }
                    }
                }else{
                    foreach ($newConnection in $newConnections){
                        if ($newConnection.RemoteAddress -eq $connection.RemoteAddress){
                            Add-Member -InputObject $connection -MemberType NoteProperty -Name "NameHost" -Value $newConnection.NameHost -Force
                        }
                    }
                }
            }
            if ($null -ne $connection.NameHost){
                if ($headersAdded) {
                    $formatting = @{n='CreationTime';e={$_.CreationTime.ToString("h:mm:ss tt")}},'Id','LocalAddress','LocalPort','RemoteAddress','RemotePort','NameHost'
                    $properties = @{Expression="CreationTime";Width=13},@{Expression="Id";Width=4},@{Expression="LocalAddress";Width=15},@{Expression="LocalPort";Width=10;Alignment="Left"},@{Expression="RemoteAddress";Width=15},@{Expression="RemotePort";Width=10;Alignment="Left"},@{Expression="NameHost";Width=100}
                    ($connection | Select-Object $formatting | Format-Table -Property $properties | Out-String).Trim() | Tee-Object -FilePath $logFile -Append
                    $headersAdded = $false
                } else {
                    ($connection | Select-Object $formatting | Format-Table -HideTableHeaders -Property $properties | Out-String).Trim() | Tee-Object -FilePath $logFile -Append
                }
                $newConnections += $connection
            }
        }
    }
}

This is my first script and have been trying to optimize it to it’s full potential. I’m stuck at this point and have no clue why the Job Ids are incrementing so quickly once a new TCP connection is made. The script can be tested by navigating to any site while the script is running.

I would appreciate any feedback. I want/have so much to learn.

-Chris