XD-813 Add more check on hsqldb shutdown
- Added a check to make sure the server state
  is changed to shutdown