Try this:
[NSApp beginSheet:scanningPanel modalForWindow:[self window]
modalDelegate:self
didEndSelector:nil
contextInfo:self];
NSTimer *tm=[NSTimer scheduledTimerWithTimeInterval:1.0
target:self
selector:@selector(closePanel:)
userInfo:nil
repeats:NO];
- (void)closePanel:(NSTimer *)theTimer
{
NSLog(@"closePanel");
[NSApp endSheet:scanningPanel];
[scanningPanel orderOut:self];
}