Competing failure mechanisms in thin films: Application to layer transfer