Check for localStorage compatibility and add `close` method.