The impact of metallicity on the formation of pre-collapsing minihalos