Hirota method for the nonlinear Schrödinger equation with an arbitrary linear time-dependent potential