Well, I think the problem clearly is that you are trying to issue a command to a process that no longer exists. I suppose that you have the osk Process variable declared at class level, so it retains its value through the lifetime of your form. In this case, I can only assume that the user of the virtual keyboard is closing the keyboard prior to closing your form. So in order to prevent the exception, just use the Process.HasExited property as a condition:
if (!osk.HasExited)
{
osk.CloseMainWindow();
}
Due to the nature of multitasking, it would still be a good idea to use a try..catch block around calls to osk methods.
MCP