MainFrm: fix graph closing

When called from OnOpenMediaFailed() and with the graph thread disabled
we tried to wait for graph thread synchronization event.