Handle case if db connection is closed