Print shifting while printing

I have had a problem with the print shifting between 2 and 5mm while printing, this usually happened about halfway or three quarters of the way through the print. I assumed the printer was slipping on the belt but the slip was not the same distance as the pitch on the belt. I then checked the pulley was not slipping on the shaft due to quick movements of the motors. Very confusing and frustrating, I then noticed it happen after I stopped watching the print and tried to think why, then it clicked that the computer was going into sleep mode, the display shuts down after 10 minutes and the computer went into sleep after 15 minutes. Cancelled the sleep mode on the computer and I have not had another print shift on the x or y axis, still testing though. Can anyone else confirm this and just passing on the info incase someone else has a similar problem and they can try the fix. Turn off sleep mode.