Update require message and delete empty file at the end in case of failure, fixes #3260