Refactor `close` to match `shutdown`