Fixed the 'finally' block to ensure it actually tears down all instances