Unload Event firing on Page Loading in Asp.net

I wanted to fire unload event when page is close or close browser tab / window. I have used below code but it is firing when page it load instead of page unload. I have used master / child page concept in asp.net

Partial Class test
    Inherits System.Web.UI.Page

    Dim dbconn As Object = New DBConnection()

    Private Sub test_Unload(sender As Object, e As EventArgs) Handles Me.Unload
        Dim cmd As SqlCommand = New SqlCommand("UPDATE test SET abc = '2' where sno = '123'", dbconn.con)
        cmd.CommandType = CommandType.Text
    End Sub

End Class