Fixed the tests shutdown issue