The key is to pass the --wait argument. On Mac and Linux you can configure EDITOR="idea --wait" . That will open the file in Intellij and you can close it afterwards with the Close Tab action (Ctrl+F4).
--wait
EDITOR="idea --wait"
Close Tab