The long wavelength moire superlattices in twisted 2D structures have emerged as a highly tunable platform for strongly correlated electron physics. We study the moire bands in twisted transition metal dichalcogenide homobilayers, focusing on WSe$_2$, at small twist angles using a combination of first principles density functional theory, continuum modeling, and Hartree-Fock approximation. We reveal the rich physics at small twist angles $theta<4^circ$, and identify a particular magic angle at which the top valence moire band achieves almost perfect flatness. In the vicinity of this magic angle, we predict the realization of a generalized Kane-Mele model with a topological flat band, interaction-driven Haldane insulator, and Mott insulators at the filling of one hole per moire unit cell. The combination of flat dispersion and uniformity of Berry curvature near the magic angle holds promise for realizing fractional quantum anomalous Hall effect at fractional filling. We also identify twist angles favorable for quantum spin Hall insulators and interaction-induced quantum anomalous Hall insulators at other integer fillings.