You need a diode to prevent current from flowing the wrong direction.