Fix race condition between SPI_finish() and SRF_RETURN_DONE()

We switch to old memory context before SPI_finish(),
but SPI_finish() "re"-switches previous memory context
due to place of SPI_connect().
Thus failed assertion is occurred in MemoryContextDelete() called from
SRF_RETURN_DONE().

So, we backup this old memory context to global variable
(to protect from forgetting) and restore memory context
before SRF_RETURN_DONE().

Signed-off-by: Taiki Kondo <kondo-taiki@mxt.nes.nec.co.jp>