fix resource not being removed from cache when it's native context was deleted