Add closeApp lua API
Merged from master