After starting the automatic mode, I cant switch it off.

You do realize that loop( ) runs continuously?

Adjust your code to fit that scenario.