Fix to close opened io resources as soon as not needed (#8839)
Fix to close opened io resources as soon as not needed (#8839)

* Fix to close opened io resources as soon as not needed

* Remove unneeded err checks

typeless/gitea,lafriks/gitea,lafriks/gitea,typeless/gitea,go-gitea/gitea,go-gitea/gitea,sapk-fork/gitea,cez81/gitea,vdbt/gitea,sapk-fork/gitea,lafriks/gitea,sapk-fork/gitea,typeless/gitea,cez81/gitea,sapk-fork/gitea,vCaesar/gitea,go-gitea/gitea,vCaesar/gitea,vdbt/gitea,cez81/gitea,typeless/gitea