remove the application from the state when it is closed