implemented close()