Refactor for unifying fragmented termination sequences
There have been fragmented termination sequences of following exit scenarios.
* h/w back key
* exit pop up menu
* exit command |pkgcmd -k|
* uninstall command |pkgcmd -u| while webapp runs
This CL makes those termination sequences go through a extended main loop.
Also, removing view stacks is only handled from closing window callback and
then the extended main loop quits to terminate webapp.
The extneded main loop provides enough time for termination of renderer thread
and prevents dead lock.
Bug: http://suprem.sec.samsung.net/jira/browse/TWF-2765
Change-Id: I0f6e8092bd092c07a841c6cab20be22c67fe4928
Signed-off-by: Youngsoo Choi <kenshin.choi@samsung.com>