fixed slight error in close method