Fix opening files twice (#64).