Learn about registry edit you can use to solve the problem of deleting a .pst file that's been recently opened in Outlook.
If you use Outlook to open a Personal Storage (PST) file, the PST file cannot be edited, moved or deleted. It‘s locked by Outlook for the duration. But that lock remains for 30 minutes by default, even after the PST file is closed in Outlook. The good news is that this value can be changed through a registry edit.
Sometimes you might have to work with archived PST files, mailbox export PST files, or even PST files as personal backups separate from your primary email storage. You can select File, Open, Outlook Data File to mount an existing PST file for viewing. When you’re finished, you can right-click the top of the PST file hierarchy in the Folder View and select Close
The action cannot be completed because the file is open in another program.
Outlook maintains a lock on the PST file for 30 minutes. Typically, you would close Outlook to gain immediate access to that PST file. There is a registry edit that can reduce the time Outlook keeps its grip on a PST file after closing it. In the following key, you add a DWORD entry called PSTDisconnectDelay:
The PST key may not exist and may need to be created. The value for PSTDisconnectDelay here is time entered in seconds. So a value of 30 using the Decimal base would keep a PST file locked by Outlook for half a minute after closing the PST file instead of the default 1800 seconds (30 minutes). Outlook would need to be restarted to assume this change as it reads the registry at startup.