corrected the .close method