Fixed quitting fate.
Fixed quitting multiple documents and added an OnPrompt event.