Edge pinning in superconducting thin films in perpendicular magnetic fields