Fixed a test shutdown issue