Handle disconnects for the ctl connection

This module should run for a long time. Mysql disconnects long running connections and therefore getting table
information causes the whole program to crash.

This is rather hard to test with a unittest, but I tested it here "manually".

@noplay what do you think?