Magnetic properties and critical currents in YBa2Cu3O7 thin films