Check for Pebble connection before activating it.

And fix SDK method wich did not close cursor...