Modifed error handling
Fixed close variant check
Cosme