If you've damaged the proximity sensor only - good, that's a normal behaviour of the iPhone when it can't reach one of its sensors, it goes every 2-5 minutes in a reboot, and generates a ".panic" file with some information about lack of access to perimetry. Google how to reach it, and analyze with panicfull.com to be sure if that's the only problem