There is nothing wrong with your files...now that I read your original post again, you didn't really say that there is a problem with your gallery, it's just the errors you found in the logs...
I think these errors comes at the moment when you were uploading modified files to the server and the exact same time someone else opened a page...I would not worry about it unless there is a problem
If uploading large functions.php file takes 5-7 seconds for you, then it would definitely explain two errors with 3 seconds apart at 2 different lines in the same file.