Once you are done with a registry key, close the key with a call to the RegCloseKey function. Calling RegCloseKey instructs Windows CE to flush any unwritten data to the key before closing the key.