private/stop/Stop-PortForwardingSession.ps1

function Stop-PortForwardingSession
{
    [CmdletBinding(PositionalBinding = $true)]
    param(
        [Parameter(Mandatory = $false)]
        [string] $SessionId
    )

    if ($SessionId)
    {
        Write-Host "Stopping port-forwarding session $SessionId.." -ForegroundColor DarkGray -NoNewline

        Stop-SSMSession -SessionId $SessionId -ErrorAction Continue | Out-Null

        Write-Host 'Done.' -ForegroundColor DarkMagenta
    }

    $Host.UI.RawUI.WindowTitle = 'EC2Remote: Disconnected'
}