Added try/finally for GPIO communication