Refactor and handle file closing/moving