Correct emit close test
Move reconnect logic to inside mqttclient

Behaviour on reconnect can be altered (indeed, needs to be altered
so it actually works) by overriding the _reconnect method.