Prevent writing output file over input file - closes #28