I don't think that it can be done. However, what you intend may be done by using another program which starts the first application, then after closing it, deletes it.
As I understand, that is what the startlazarus program does with lazarus (after you rebuild the IDE, it terminates lazarus process, deletes lazarus exe file and replaces it with the newly created one, then starts it).