CA-146822: Harden fix for intermittent test failures test_close_if_open_failed

These changes are provided to harden the following pull request, which has already been merged:
https://github.com/xapi-project/sm/pull/222

Some intermittent problems were still being observed, even after applying the previous PR.

Thanks.

Signed-off-by: Flavien Quesnel <flavien.quesnel@citrix.com>