Correctly set the end date of duplicated events (see #5608)