Cleanup method now closes active shell which was not closed