Reset the database connection after MySQL bulk insert failure

After a bulk insert failure in MySQL (caused by servers not
allowing this by default) we fall back to a line by line insert.
However, using pymysql the failed insert causes the database
connection to get hung up.

This commit creates a new method to reset the connection and
calls it prior to starting the line by line insert.

Fixes #93.