On the Mechanism of the Thermal and Photolytic Cyclization of Diphenylamines to Carbazoles