Network Rail has issued an appeal for people to use level crossings safely after a near-miss close to a railway station in the West Midlands.