close db connection after work to avoid 'remaining connection slots are...

close db connection after work to avoid 'remaining connection slots are reserved for non-replication superuser connections'
2 jobs for master in 5 minutes and 5 seconds (queued for 12 seconds)