Close open cursors

Cursors which got created during any query, needs to be closed
finally. Otherwise it'll cause leak in resource and cursor window
allocation will fail.

Change-Id: I65ace2dc227e0a50c163faba13fdb0fbfa71bc6c
CRs-Fixed: 594264