Added onCloseRequest handler for application