Added a debug handler to track open DB states