add dirty db close function which closes file handles.