I just saw this idea on Stackoverflow and had to try it:
http://stackoverflow.com/questions/10343102/closing-notepad-when-the-last-document-is-closed

The Initialisation mode has to be ATSTARTUP and the code is placed at the end of the startup.py

def shutdownNppOnLastFileClosed(args):
    import os
    files = notepad.getFiles()
    # there are always at least 2 'buffers' open in N++
    if len(files) == 2:
        currentBufferID = notepad.getCurrentBufferID()
        for (filename, bufferID, index, view) in files:
            if os.path.exists(filename):
                break
            notepad.activateBufferID(bufferID) 
            if editor.getLength() > 0:
                break
            # TODO: just to be on the safe side - if we
            # reached here, we actually should also check
            # if the 2 left empty buffers are not unsaved,
            # but I couldn't find a way to do that.
        else:
            # following 'menuCommand' looks cleaner than
            # the 'sys.exit' but it currently deadlocks N++:
            #notepad.menuCommand(MENUCOMMAND.FILE_EXIT)
            sys.exit(0)
        notepad.activateBufferID(currentBufferID)
notepad.callback(shutdownNppOnLastFileClosed, [NOTIFICATION.FILECLOSED])