Check sanity before calling disconnect

Signed-off-by: Jari Vanhala <jari.vanhala@ixonos.com>