Added "if main" clause to test module

Ran 2to3 utility and added file closures to test module to get rid of ResourceWarnings in python3. Code is now compatible with python 2.7 and 3.4

Added import of __future__ lib to enable backwards compatibility with python2

Woops. The  __future__ import has to be at the top