Almost half of maternity units closed their doors to new admissions at least once in the last year, new figures show.