fixing shutdown method so it works for embedded and service dbs