Fixed the problem where the application never terminated.