kbx: Fix deadlock in gpgsm on Windows due to a sharing violation.
* kbx/keybox-init.c (keybox_lock) [W32]: Use _keybox_close_file instead of fclose so that a close is done if the file is opened by another handle. * kbx/keybox-search.c (keybox_search): Remember the last offset and use that in NEXT search mode if we had to re-open the file.
- GnuPG-bug-id: T4505
- Signed-off-by: Werner Koch <wk@gnupg.org>