Add gpio.cleanup()

See comments. You may want to try this code on your setup before you merge it.