[DF-4657] Fixed wrong task management at the application closing.