Check if `db` is available before save file to DB in case user fails to create DB.