Added atExit handler to reset output pins