To gracefully close/disconnect a serial port connection with the iTerm2 plugin, use the following keystroke: control+a+k
You'll be asked to confirm the action. To do so, simply type "y".

If you're not following this procedure, the session will stay open in the background until you manually kill it using Activity Monitor or by using the "kill" command.

Here's some information on macOS' built-in "screen" command, which is used by our iTerm2 plugin for serial port connections:

Another possible workaround is to create a command task that executes something along the lines of "pkill -f SCREEN" when the connection is closed.