Might Fix #36

i don't have this problem, but it is possible to happen since if the process just exits. It would be more appropriate especially for remote databases if it would loop until it connects. Now the closure just makes sure that the db exists before exporting the module (modules load synchronously) but if the db is just slow it will fail again.