Thanks for the replies.
I installed a new battery as the old one would not hold a decent charge. I also reset the brake manually and that did not help. All the connections and fuses are good also. The brake modulator would still just click repeatedly for no reason even after the engine was turned completely. I went ahead and took off the brake modulator to check the wire connection and inside the modulator one of the terminal where the pins connect to the wires is all corroded. I ordered a new brake modulator and hope this will solve the problem.