def _close_sd_ref():
 global SD_REF
 if SD_REF:
  SD_REF.close()
  SD_REF = None

def _close_sd_ref ( ) : global SD_REF if SD_REF : SD_REF . close ( ) SD_REF = None
close the sd_ref object if it isnt null for use with atexit .