Fix for a rare dispatcher exception.
Removed comments and added braces.
fixes #547, simplifies close behaviour to run command handler before closing item