Bug 1071249 - Create cron job for expired tasks

Add routine to close attempts for expired tasks
Good suggestion, thanks @glogiotatidis! I will update the test.