This is going to be specific to the environment you are using to get the reference. If you are doing this in a TestStand sequence, the reference will be automatically closed when you the variable goes out of scope. If you are using LabVIEW, you will need to use the Close Reference VI. In CVI, you will need to use the CA_DiscardObjHandle method. In C++, if you are using the StepPtr class, you do not need to do anything. In C# or VB.NET, you do not need to do anything since it will be automatically cleaned up by the garbage collector.
Allen P.
NI