iTerm reports error on exit

Description
Once in a while, when I exit MacVim (gvim), after opening a file from Ranger, I get the error message of the form: MacVim[9999:99999] *** [NSMachPort hadnlePortMessage:]: dropping incoming DO message because the connection is invalid.

To Reproduce

  1. Open a file file in MacVim from Ranger.
  2. Quite MacVim issuing Command-Q.
  3. See the error in Ranger.

System

  • MacOS 10.12.6
  • MacVim version 8.1 (Included patches: 1-2234)
  • Ranger version 1.9.2 (Python version 2.7.10)