Long-range memory in internal and forced dynamics of millennium-long climate model simulations