You are correct! The internal energy of the water is a state function and does not depend on the history of the sample.