Pass the global variables to the new worker object to minimise future work in removing globals. Also fix disconnect to close the database not drop it.