Unlocking of an elastic string from a periodic substrate