Corrected the exit application logic, checks if any projects are dirty before closing.