Fix memory leak in the psd saving code
The undo command should be deleted. Thanks Boud for pointing out the problem.