[webgpu] fix runtime error caused by buffer release too early (#25485)
### Description
Fix runtime error caused by buffer release too early
### Motivation and Context
#25276 introduces buffer usage optimization, which reduced the peak GPU
memory usage. However, the implementation may cause issue in some
situations because the buffer is released too early. This PR fixes the
issue.