Can't restart because OS X thinks an app is open
This bug occurs occasionally for me, and the ‘safest’ workaround I've found which I use is to quit all other open apps, then quit (not force quit) WindowServer. This logs out the current user without taking regard for apps which desire to interrupt this process, or apps which the OS still believe are running.

                         

According to an Apple Support Communities thread, this problem is caused by the kernel:


  If "killall -KILL process_name" or "kill -KILL process_pid_number" does not kill the process, then that process is hung in the kernel, as a kill signal cannot be delivered until the process returns from kernel space to user space.


Source: https://discussions.apple.com/message/26762830?tstart=0#26762830

…but I'm not certain how accurate this is. Certain apps seem to exhibit this behaviour more often than others and I am yet to find a link as to what the actual cause of the problem/bug is.