Being a Pythonscript programmer, and having wanted to do the same type of thing in the past, I didn’t really find that it is possible in P.S., but maybe with a true plugin it IS possible?

Anyway, what I do in a P.S. is, since you are discarding changes anyway, is execute repetitive “undo” operations until you get the file back to an unmodified state. Then it can be closed without Notepad++ prompting for anything.

Of course, if you want to save the changes, what I do via P.S. is a “save” and then the “close” on the file. There should be something mimicing that for true plugins.