Fixed an open file leak where replayopened and reopened files repeatedly without ever closing them.
Merge branch 'open-file-leak'