Skip closing database connections if Threadi is running a NonThread