在微信浏览器中如何让他自动关闭当前页面回到会话框js

<script type="text/javascript">
    wx.config(jssdkconfig);

    require(['jquery', 'util'], function($, util){
        var latitude;
        var longitude;
        var speed;
        var accuracy;
        wx.ready(function () {
            //test();
            wx.onMenuShareAppMessage(sharedata);

            wx.onMenuShareTimeline(sharedata);

            wx.onMenuShareQQ(sharedata);

            wx.onMenuShareWeibo(sharedata);
            
            wx.getLocation({
                type: 'wgs84', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
                success: function (res) {
                    latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
                    longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
                    speed = res.speed; // 速度,以米/每秒计
                    accuracy = res.accuracy; // 位置精度
                    alert('纬度:'+latitude+'经度:'+longitude+'速度:'+speed+'精度:'+accuracy); 
                },
                cancel: function (res) {
                    alert('用户拒绝授权获取地理位置');
                    aWeixinJSBridge.call('closeWindow');  
                }
            });
        });

    });

</script>

这是针对微擎的html页面的js代码