close() must be done always