fix loading before closing modal