Check if handler_id is connected before disconnect

Closes #40
https://github.com/mate-desktop/mate-document-viewer/issues/40