Coming back from the dead and updating my AddOn(s).
My DK AddOn has been troubled with FrameLocks.lua issues since Pet Battles were introduced. I did some research but couldn't get a handle on much. Maybe one of the fine folks around here has more experience / can spot something I cannot.
You're overwriting the Blizzard global variable "RuneFrame", which in turn is a variable that's added to the framelocks table, that's the cause of your error. If it didn't error, it would taint like hell.
Don't mess with anything added to that table and don't try to add anything to it.
Whilst you're at it you should make all your functions local, they are currently global which pollutes the namespace. You're also setting a global variable called "imagetimer".