(preferably) free app to lock iPhone for predetermined periods of time
There are no App Store apps which are able to prevent other apps from being opened. Apple does not provide such functionality to apps, so you will not be able to find an app which is able to do this.

Preventing apps from being used is something the OS can do for some native apps. See Settings → General → Restrictions for being able to set a passcode to prevent access to certain functionality on the device.