Add close handler support to OptiqConnection for resource cleanup.