CA-127974: Added more checks to prevent XenCenter crash while closing [XOP-521]

Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
Merge pull request #20 from MihaelaStoica/master

CA-127974: Added more checks to prevent XenCenter crash while closing [X...