Ref closing sections with indexRef function correctly