Closed each cursor after use
Removed lint warnings