utils & idb: Add functions to generate hash flags and close iDB on INIT

Signed-off-by: Michal Novotny <mignov@gmail.com>