Enhancement of the critical temperature in iron pnictide superconductors by finite-size effects