Disconnect database connections when rescuing exceptions.

We have a special use case in which the `Message` class can drop an ongoing `ActiveRecord` query blocking the current `MySQL` connection. This can happen when the `Message#run_handler` method raises `Timeout::Error`. If this happens, in following `ActiveRecord` queries we can get the error:

```
Mysql2::Error: This connection is still waiting for a result, try again once you have the result:
```

To fix this we just need to disconnect the `ActiveRecord` database connection in case we got an error, ensuring that any following query will run as expected.

Note that this only happens with `MySQL`. I tested `SQLite` and `Postgres` and they don't have this problem, but they work well with the fix as well.