I thought it did this by default - at least for Tasks in the MSF Agile 5.0 process template it does.
Anyway, what you need is a rule on the Transition from Active to Closed to copy some values and and empty the remaining work:
<TRANSITION from="Active" to="Closed">
<!--Reasons snipped -->
<FIELDS>
<!--Other fields snipped -->
<FIELD refname="Microsoft.VSTS.Scheduling.RemainingWork">
<EMPTY />
</FIELD>
<FIELD refname="Microsoft.VSTS.Scheduling.OriginalEstimate">
<WHEN field="Microsoft.VSTS.Scheduling.OriginalEstimate" value="">
<COPY from="field" field="Microsoft.VSTS.Scheduling.CompletedWork" />
</WHEN>
</FIELD>
<FIELD refname="Microsoft.VSTS.Scheduling.CompletedWork">
<WHEN field="Microsoft.VSTS.Scheduling.CompletedWork" value="">
<COPY from="field" field="Microsoft.VSTS.Scheduling.OriginalEstimate" />
</WHEN>
</FIELD>
</FIELDS>
</TRANSITION>