Close connection before and after executing periodic OCR task, to avoid stale DB connection remaining open. Ref: Issue #4