close db in any case