Close file explicitely, better for PyPy
Better synchronisation routines, needed for running under the slow PyPy