The Effect of Volume and Surface Inhomogeneities on the Coercivity of Thin Magnetic Films