PIC18 electric connection loose
Connecting BOTH pairs of VDD/VSS is absolutely required. Connecting only one pair is not optional and may produce unpredictable results. And it's wise to put decoupling capacitors on each pair separately.

The behavior associated with the proximity to your hand may be because you left the PGM pin unconnected. If you have LVP enabled (one of the configuration bits in your code), the PIC will go into programming mode if the PGM pin is driven high. The PGM pin should be tied to ground for normal operation. But if that pin is left floating, it acts like an antenna and any nearby electrostatic force (your hand) may cause it to swing high or low. However, if you do not have LVP enabled, that is unlikely the problem.

On another note, Microchip recommends a resistor between MCLR and VDD. A 10k resistor is common.