There's not a way to automate, that I know of. For example, if a task duration is set for 5/1-5/15 and the task was closed on 5/9, the task can still show as overdue and appear on people's timesheets, work, allocation, etc unless you change the end/complete date. We built a report that shows all overdue tasks, grouped by Project Manager, so that our PMs can easily go in and backdate the task end date so that it has a hard stop and does not pull into anything after it's been complete. We also have a report that shows incomplete tasks so that the PMs can bulk edit and close tasks on a monthly basis.