but the command file would need to be able to identify which files were open, name them correctly and store them in the correct locatons
Only way I can see of doing it would be if every new file was initially saved under a new name on opening, so on closure those particular file names are saved, and also the default save location for the programs were changed. You'd have to do this for each program and in many cases you would not be able to do so: that function would not be present. You could change the default save location for MS Office, but then ALL office programs would save to it by default, all the time