Nonsingular and ghost-free infinite derivative gravity with torsion