Optimized expanded ensembles for simulations involving molecular insertions and deletions. I. Closed systems.