Layer-Dependent Magnetic Structure and Anomalous Hall Effect in the Magnetic Topological Insulator MnBi4Te7.