I figured it out. In my game, if player leaves a certain area, player has to die. And when I change the scene, the "area_exited" signal is executed from that Area2D
and it restarts the scene before it can change to next level.
So I simply added this to level script:
var finished : bool = false
And this to the Area2D
s script:
func onbodyexited(body):
if body == level.player and !level.finished:
level.restartlevel()
Anyway still thanks to IceExplosive for trying to help!