It happens randomly. When you open Mr. TomatoS there is a small chance that instead of the normal open screen there is a black screen with "a fatal arror has occurred" written all over it and the ending just happens. Keep in mind that you do not need to reset the game after the ending has finished