added DB wrapper and manual close() methods