implement support of close()