Travis: add PEP8 tests

and fix contest.py so that the application is always closed properly and never created if there is no need