Millions wasted in failed NHS hospital closure programme