Ensure that we remove the old file when we rename.

Conflicts:
	app/views/file.js
typo

@hdgarrood: fix code style.