Fix handle of Database closing/opening during Network
disconnection/connection