Fix the close method bug.