Use the cookie file for checking xapi's status

Hopefully it will prevent races.