When does the flow of heat between two materials stop?