fixed another invalid cursor release issue revealed by Python 2.7
fixed another invalid cursor release issue revealed by Python 2.7

fazalmajid/temboz,fazalmajid/temboz,fazalmajid/temboz,fazalmajid/temboz