Take exclusive lock on index relation before actual swapping

This is to reduce the likelihood of deadlock when swapping indexes.
Per comment of Andres.