Use withFile instead of openFile.