I took a look at your code. Not sure why the clock is doing that to you, but Rene could be correct. I’ve not had a clock do that to me before so I couldn’t personally confirm.
I don’t typically use the RTC library as I only need a couple of functions (set time and get time) so I just put the operations within the main sketch. If you would like to, you can try the modified code attached. just rename the extension from .txt to .ino. It is your same code just modified to use the clock structure as I do. It didn’t look like you were pulling anything else from the clock either. I use a DS3231(chronodot setup), but the 1307 is the same address I believe.
I’m not sure how the library you had performs the time setting but this adds an option for you to send a time update to the sketch over the serial port whenever you like. Its explained at the top of the sketch.