PutImage: Could not lock the offscreen surface for writing

Sometimes, I have the following error. There is no way to continue
except restart MatLab. Anyone knows what causes this problem? I use PTB
2.54 under Windows XP. Thank you. -Xiangrui

??? PutImage: Could not lock the offscreen surface for writing.
Error in ==> myCode at 82
Screen(w,'PutImage',img, rect);