Magnetic hysteresis in thin ferromagnetic films