Construction of central elements in the affine Hecke algebra via nearby cycles