Add stop function so that references can be fully cleared and deallocated.