You are very right about not removing pen drives without stopping them first.

Even when the drive appears to be "not in use" by you it could still be in use by some other function in the system.

Or sometimes it can be just that the system function that was using the device forgot to shut it off properly and it's still running.

One of the main problems with removing a pen drive is to do with buffering. Buffering works to make the PC look like it's actually completed a task when really it hasn't. This is because when computers write data to drives (even hard drives) they normally build a buffer of the data, and then write all the data in one go. It is quicker to write a big wad of data than to keep writing small 1kb changes every 5 seconds.

This is the reason you should never remove your drive unless the computer knows it has fully finished using the drive, because some of the data could be still sat in the buffer, if you remove the drive then you will lose the buffered data.

Normally with buffering though this tends to clear up on the second or third attempt, because by this point Windows realises you really want to remove the drive and flushes the buffer.

Some of the other things that can take control over devices and still use them are some music players, like WinAMP when it assigns your device as a media player. It could still be using your pen drive in the background, or sometimes if it's playing a song from your pen drive. Document readers and web browsers can also do the same, if they are downloading content to the drive.

Then you can also have viruses, some viruses write to pen drives and Windows isn't able to release them either. The worst trick is when they create a hidden file on the root of the drive called "AUTORUN.INF" this allows the virus to automatically install itself onto the next computer the drive is plugged into.

Sometimes just having a windows explorer window open can also tell Windows the drive is in use, even though it isn't, try closing the Explorer windows open (My Computer, My Documents, etc).

If all else fails there are two tricks you can try...

First one - this is very risky and could result in data loss but most of the time is fine, wait for your hard drive light (red light) on your computer to full go out and for the drive to stop whirring all together (that's handy if the hard drive light on your computer isn't connected). Once you've made sure that the hard drive light has stopped flashing, and you've closed all open programs down, then remove the drive. Most of the times this works fine, but not 100% guaranteed.

Secondly - Shut the computer down (by using start->shut down or pressing the power button and waiting for windows to do it's shutdown (nb don't hold the power button down as that's an emergency shut down), I know it can be a bit of a pain powering down and then back up again if all you want to do is remove the drive, but if you shut your computer down, and then remove the drive after the power is off the computer certainly can't be writing data to it.

Also if you have a drive that you suddenly find no longer works in your PC try this trick - shut the computer down fully, remove the power cable from the back fully (or in the case of a laptop remove the battery and mains charger). Plug it all back in and then reboot. Your drive might revive itself then - I was so surprised at this trick, and the reason for this is that when Windows detects what it believes to be a "damaged" USB device, it sets a flag in the memory to tell it that this device is damaged, the memory that holds this information is on the same circuit that lights up the green led on your motherboard (the one that only goes out if you actually unplug the computer from the mains), so no matter how many restarts, or power downs you do you'll never reset it without unplugging fully. It took me ages to figure that one out when I had a device that would work on all other computers except on, and I just couldn't get my head round why this one PC just didn't like the device, I then found the answer on the net and couldn't believe it would actually work, until I tried it.