Arduino Always flashes three times when I release the button.

There is no debouncing in that sketch, so I imagine the button is bouncing. Try the Debounce sketch.