If you are familiar with Python, you can try the Python Script plugin for N ++. You must set a script callback for the closed document. Inside, it performs some iteration through all open documents, and when there is only 1 left, without text in it, then complete N ++.
Personally, I have mapped the Alt + x keys to Exit Notepad ++, which is easier to engrave than Alt + F4 usually works.
/ EDIT
I really liked your idea, so I quickly tried it. It took ~ 20 minutes to figure this out. Here's the complete solution:
def shutdownNppOnLastFileClosed(args): import os files = notepad.getFiles()
source share