Fixed #6 and simplified TCK's close function.