Budget deficit narrows in 2017