issue #14 - properly closing db connections

by Andy, Michi