a) Maybe your stepper drivers get to hot after some time and power off?
b) There is a setting in your marlin firmware:
// Disables axis when it's not being used. // WARNING: When motors turn off there is a chance of losing position accuracy! #define DISABLE_X false #define DISABLE_Y false #define DISABLE_Z false
I don’t know the exact behaviour of the disableing process, because I never set this value to true. Could it be possible that you set this value to true and after some idle time the steppers turn off?