Fix command execution function and catch error for existing output file