The pgrep command was failing to match Wine processes with long names like "c:\nyanchangame\bk\play.exe" because pgrep by default only matches against the first 15 characters of process names. Fixed by adding the -f flag to match against the full command line.