Properly cleans the application on close. At first glance, this modification is not needed since the VM is expected to be closed after the stop method is called. However if the application is called from java (for example from a test) we want the application to properly start and do not keep references olds arguments. Change-Id: I367533475031629a9edd9176547479db23e4cfcf