Not quite sure what you mean here, but the filing system will tidy up open files on orderly shutdown anyway regardless of medium.
If there's data lying around in an application, rather than the operating system, which you haven't saved, then most applications will ask "do you want to save" and delay an (orderly) shutdown until you answer, and again this is independent of medium. If you want this done automatically without human intervention then it seems to me that you've got two choices:
(a) find an option belonging to each individual application you care about that says "on shutdown, save the file I'm editing without asking me first" (I've never noticed any such options, but that doesn't mean there aren't any)
(b) write some sort of script or application or whatever that spots what's going on and answers "yes" to each application that asks you whether you want to save a file (this piece of software would have to know about each target application in some detail).
Are you asking whether anyone has already written a (b) that you can download? Not something I've heard of, but that doesn't mean there isn't one. And again, it would work just as well with disk, it's nothing to do with having a flash drive.
If you're in the middle saving a file from some application and pull the power plug, ie a disorderly shutdown, then modern operating systems (unlike early versions of Unix) should not corrupt the filing system, but you have no guarantees as to how much of the data in that particular file has been saved, and no software can make that any better. And again this is independent of medium.