Impact of work schedules of senior resident physicians on patient and resident physician safety: nationwide, prospective cohort study