fix a mismatched #end in SWIG templates

I know almost nothing about SWIG, but it seems it wants `#end if` not `#end` here.