Check to see if the db is closed before attempting to close, fixes #65
:monkey_face: