Fix open/close action
Now supports Python 2 and 3