Fix: so that close() can be called multiple times