Check if queue object exists
Check for null before freeing memory.