Updated iOS implementation to handle close and disconnect according to the plugin API specification.