Fixed errors when shutting down server in case of failed init